testutils

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDependencies

func CopyDependencies(deps *typesv1.Dependencies) *typesv1.Dependencies

func NewMemoryStateContainer

func NewMemoryStateContainer() state.Container

func NewMockBlueprintLoader

func NewMockBlueprintLoader(
	stubDiagnostics []*core.Diagnostic,
	clock commoncore.Clock,
	instances state.InstancesContainer,
	deployEventSequence []container.DeployEvent,
	changeStagingEventSequence []ChangeStagingEvent,
	opts ...MockBlueprintLoaderOption,
) container.Loader

func NewMockBlueprintValidationStore

func NewMockBlueprintValidationStore(
	validations map[string]*manage.BlueprintValidation,
) manage.Validation

func NewMockChangesetStore

func NewMockChangesetStore(
	validations map[string]*manage.Changeset,
) manage.Changesets

func NewMockEventStore

func NewMockEventStore(
	events map[string]*manage.Event,
) manage.Events

func SSEToManageEvent

func SSEToManageEvent(
	event *sse.Event,
) *manage.Event

Types

type ChangeStagingEvent

type ChangeStagingEvent struct {
	ResourceChangesEvent  *container.ResourceChangesMessage
	ChildChangesEvent     *container.ChildChangesMessage
	LinkChangesEvent      *container.LinkChangesMessage
	FinalBlueprintChanges *changes.BlueprintChanges
	Error                 error
}

type DeployEventWrapper

type DeployEventWrapper struct {
	DeployEvent *container.DeployEvent
	DeployError error
}

type FailingIDGenerator

type FailingIDGenerator struct{}

func (*FailingIDGenerator) GenerateID

func (f *FailingIDGenerator) GenerateID() (string, error)

type MemoryStateContainer

type MemoryStateContainer struct {
	// contains filtered or unexported fields
}

func (*MemoryStateContainer) Children

func (*MemoryStateContainer) Exports

func (*MemoryStateContainer) Instances

func (*MemoryStateContainer) Metadata

func (*MemoryStateContainer) Resources

type MockBlueprintContainer

type MockBlueprintContainer struct {
	// contains filtered or unexported fields
}

func (*MockBlueprintContainer) BlueprintSpec

func (m *MockBlueprintContainer) BlueprintSpec() speccore.BlueprintSpec

func (*MockBlueprintContainer) Deploy

func (m *MockBlueprintContainer) Deploy(
	ctx context.Context,
	input *container.DeployInput,
	channels *container.DeployChannels,
	paramOverrides core.BlueprintParams,
) error

func (*MockBlueprintContainer) Destroy

func (m *MockBlueprintContainer) Destroy(
	ctx context.Context,
	input *container.DestroyInput,
	channels *container.DeployChannels,
	paramOverrides core.BlueprintParams,
)

func (*MockBlueprintContainer) Diagnostics

func (m *MockBlueprintContainer) Diagnostics() []*core.Diagnostic

func (*MockBlueprintContainer) RefChainCollector

func (m *MockBlueprintContainer) RefChainCollector() refgraph.RefChainCollector

func (*MockBlueprintContainer) ResourceTemplates

func (m *MockBlueprintContainer) ResourceTemplates() map[string]string

func (*MockBlueprintContainer) SpecLinkInfo

func (m *MockBlueprintContainer) SpecLinkInfo() links.SpecLinkInfo

func (*MockBlueprintContainer) StageChanges

type MockBlueprintLoader

type MockBlueprintLoader struct {
	// contains filtered or unexported fields
}

func (*MockBlueprintLoader) Load

func (m *MockBlueprintLoader) Load(
	ctx context.Context,
	blueprintSpecFile string,
	params core.BlueprintParams,
) (container.BlueprintContainer, error)

func (*MockBlueprintLoader) LoadFromSchema

func (m *MockBlueprintLoader) LoadFromSchema(
	ctx context.Context,
	blueprintSchema *schema.Blueprint,
	params core.BlueprintParams,
) (container.BlueprintContainer, error)

func (*MockBlueprintLoader) LoadString

func (m *MockBlueprintLoader) LoadString(
	ctx context.Context,
	blueprintSpec string,
	inputFormat schema.SpecFormat,
	params core.BlueprintParams,
) (container.BlueprintContainer, error)

func (*MockBlueprintLoader) Validate

func (m *MockBlueprintLoader) Validate(
	ctx context.Context,
	blueprintSpecFile string,
	params core.BlueprintParams,
) (*container.ValidationResult, error)

func (*MockBlueprintLoader) ValidateFromSchema

func (m *MockBlueprintLoader) ValidateFromSchema(
	ctx context.Context,
	blueprintSchema *schema.Blueprint,
	params core.BlueprintParams,
) (*container.ValidationResult, error)

func (*MockBlueprintLoader) ValidateString

func (m *MockBlueprintLoader) ValidateString(
	ctx context.Context,
	blueprintSpec string,
	inputFormat schema.SpecFormat,
	params core.BlueprintParams,
) (*container.ValidationResult, error)

type MockBlueprintLoaderOption

type MockBlueprintLoaderOption func(*MockBlueprintLoader)

func WithMockBlueprintLoaderChangeStagingError

func WithMockBlueprintLoaderChangeStagingError(err error) MockBlueprintLoaderOption

func WithMockBlueprintLoaderDeployError

func WithMockBlueprintLoaderDeployError(err error) MockBlueprintLoaderOption

type MockBlueprintResolver

type MockBlueprintResolver struct{}

func (*MockBlueprintResolver) Resolve

type MockBlueprintValidationStore

type MockBlueprintValidationStore struct {
	BlueprintValidations map[string]*manage.BlueprintValidation
	// contains filtered or unexported fields
}

func (*MockBlueprintValidationStore) Cleanup

func (s *MockBlueprintValidationStore) Cleanup(ctx context.Context, thresholdDate time.Time) error

func (*MockBlueprintValidationStore) Get

func (*MockBlueprintValidationStore) Save

func (s *MockBlueprintValidationStore) Save(
	ctx context.Context,
	blueprintValidation *manage.BlueprintValidation,
) error

type MockChangesetStore

type MockChangesetStore struct {
	Changesets map[string]*manage.Changeset
	// contains filtered or unexported fields
}

func (*MockChangesetStore) Cleanup

func (s *MockChangesetStore) Cleanup(ctx context.Context, thresholdDate time.Time) error

func (*MockChangesetStore) Get

func (*MockChangesetStore) Save

func (s *MockChangesetStore) Save(
	ctx context.Context,
	Changeset *manage.Changeset,
) error

type MockClock

type MockClock struct {
	StaticTime   time.Time
	TimeSequence []time.Time
}

func (*MockClock) Now

func (c *MockClock) Now() time.Time

type MockEventStore

type MockEventStore struct {
	Events          map[string]*manage.Event
	EventPartitions map[string][]*manage.Event
	// contains filtered or unexported fields
}

func (*MockEventStore) Cleanup

func (s *MockEventStore) Cleanup(ctx context.Context, thresholdDate time.Time) error

func (*MockEventStore) Get

func (s *MockEventStore) Get(
	ctx context.Context,
	id string,
) (manage.Event, error)

func (*MockEventStore) Save

func (s *MockEventStore) Save(
	ctx context.Context,
	evt *manage.Event,
) error

func (*MockEventStore) Stream

func (s *MockEventStore) Stream(
	ctx context.Context,
	params *manage.EventStreamParams,
	streamTo chan manage.Event,
	errChan chan error,
) (chan struct{}, error)

type MockPluginConfigPreparer

type MockPluginConfigPreparer struct {
	// Mapping of a config value to a list of diagnostics
	// that should be returned when the given value is used.
	Fixtures map[string][]*core.Diagnostic
}

func NewMockPluginConfigPreparer

func NewMockPluginConfigPreparer(
	fixtures map[string][]*core.Diagnostic,
) *MockPluginConfigPreparer

func (*MockPluginConfigPreparer) Prepare

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL