testutils

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertConfigDefinitionEquals

func AssertConfigDefinitionEquals(
	expected *core.ConfigDefinition,
	actual *core.ConfigDefinition,
	testSuite *suite.Suite,
)

AssertConfigDefinitionEquals asserts that two core config definitions are equal. This treats nil and empty slices in the config field definitions as equal.

func AssertInvalidHost

func AssertInvalidHost(
	respErr error,
	action errorsv1.PluginAction,
	invalidHostID string,
	testSuite *suite.Suite,
)

AssertInvalidHost asserts that the given error is an invalid host error from a plugin method call response.

func AssertLinkChangesEquals

func AssertLinkChangesEquals(
	expected *provider.LinkChanges,
	actual *provider.LinkChanges,
	testSuite *suite.Suite,
)

AssertLinkChangesEquals asserts that two provider link changes are equal. This treats nil and empty slices in the changes as equal.

func AssertSlicesEqual

func AssertSlicesEqual[Item any](
	expected []Item,
	actual []Item,
	testSuite *suite.Suite,
)

AssertSlicesEqual asserts that two slices are equal. Nil and empty slices are considered equal. The order of the elements in the slices must be the same.

func CreateEmptyConcreteParams

func CreateEmptyConcreteParams() *core.ParamsImpl

CreateEmptyConcreteParams creates an empty set of concrete parameters for testing, primarily used for testing plugin functions.

func CreateEmptyTestParams

func CreateEmptyTestParams() core.BlueprintParams

CreateEmptyTestParams creates an empty set of parameters for testing, primarily used for testing plugin functions.

func CreateTestLinkContext

func CreateTestLinkContext() provider.LinkContext

CreateTestLinkContext creates a link context for testing.

func CreateTestProviderContext

func CreateTestProviderContext(namespace string) provider.Context

CreateTestProviderContext creates a provider context for testing with the given namespace.

func CreateTestTransformerContext

func CreateTestTransformerContext(namespace string) transform.Context

CreateTestTransformerContext creates a transformer context for testing with the given namespace.

func NewMemoryStateContainer

func NewMemoryStateContainer() state.Container

func StartPluginServiceServer

func StartPluginServiceServer(
	hostID string,
	pluginManager pluginservicev1.Manager,
	functionRegistry provider.FunctionRegistry,
	resourceService provider.ResourceService,
) (pluginservicev1.ServiceClient, func())

Types

type FunctionCallArgsMock

type FunctionCallArgsMock struct {
	Args    []any
	CallCtx provider.FunctionCallContext
}

func (*FunctionCallArgsMock) Export

func (f *FunctionCallArgsMock) Export(ctx context.Context) ([]any, error)

func (*FunctionCallArgsMock) Get

func (f *FunctionCallArgsMock) Get(ctx context.Context, position int) (any, error)

func (*FunctionCallArgsMock) GetMultipleVars

func (f *FunctionCallArgsMock) GetMultipleVars(ctx context.Context, targets ...any) error

func (*FunctionCallArgsMock) GetVar

func (f *FunctionCallArgsMock) GetVar(ctx context.Context, position int, target any) error

type FunctionCallContextMock

type FunctionCallContextMock struct {
	CallCtxParams          *core.ParamsImpl
	CallCtxRegistry        provider.FunctionRegistry
	CallStack              function.Stack
	CallCtxCurrentLocation *source.Meta
}

func (*FunctionCallContextMock) CallStackSnapshot

func (f *FunctionCallContextMock) CallStackSnapshot() []*function.Call

func (*FunctionCallContextMock) CurrentLocation

func (f *FunctionCallContextMock) CurrentLocation() *source.Meta

func (*FunctionCallContextMock) NewCallArgs

func (*FunctionCallContextMock) Params

func (*FunctionCallContextMock) Registry

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 MockProvider

type MockProvider struct {
	ProviderNamespace string
}

MockProvider is a mock implementation of the `provider.Provider` interface for plugins in launch testing.

func (*MockProvider) ConfigDefinition

func (m *MockProvider) ConfigDefinition(ctx context.Context) (*core.ConfigDefinition, error)

func (*MockProvider) CustomVariableType

func (m *MockProvider) CustomVariableType(
	ctx context.Context,
	customVariableType string,
) (provider.CustomVariableType, error)

func (*MockProvider) DataSource

func (m *MockProvider) DataSource(
	ctx context.Context,
	dataSourceType string,
) (provider.DataSource, error)

func (*MockProvider) Function

func (m *MockProvider) Function(
	ctx context.Context,
	functionName string,
) (provider.Function, error)
func (m *MockProvider) Link(
	ctx context.Context,
	resourceTypeA string,
	resourceTypeB string,
) (provider.Link, error)

func (*MockProvider) ListCustomVariableTypes

func (m *MockProvider) ListCustomVariableTypes(ctx context.Context) ([]string, error)

func (*MockProvider) ListDataSourceTypes

func (m *MockProvider) ListDataSourceTypes(ctx context.Context) ([]string, error)

func (*MockProvider) ListFunctions

func (m *MockProvider) ListFunctions(ctx context.Context) ([]string, error)

func (*MockProvider) ListLinkTypes

func (m *MockProvider) ListLinkTypes(ctx context.Context) ([]string, error)

func (*MockProvider) ListResourceTypes

func (m *MockProvider) ListResourceTypes(ctx context.Context) ([]string, error)

func (*MockProvider) Namespace

func (m *MockProvider) Namespace(ctx context.Context) (string, error)

func (*MockProvider) Resource

func (m *MockProvider) Resource(
	ctx context.Context,
	resourceType string,
) (provider.Resource, error)

func (*MockProvider) RetryPolicy

func (m *MockProvider) RetryPolicy(ctx context.Context) (*provider.RetryPolicy, error)

type MockTransformer

type MockTransformer struct {
	TransformName string
}

MockTransformer is a mock implementation of the `transform.SpecTransformer` interface for plugins in launch testing.

func (*MockTransformer) AbstractResource

func (m *MockTransformer) AbstractResource(
	ctx context.Context,
	resourceType string,
) (transform.AbstractResource, error)

func (*MockTransformer) ConfigDefinition

func (m *MockTransformer) ConfigDefinition(ctx context.Context) (*core.ConfigDefinition, error)

func (*MockTransformer) GetTransformName

func (m *MockTransformer) GetTransformName(ctx context.Context) (string, error)

func (*MockTransformer) ListAbstractResourceTypes

func (m *MockTransformer) ListAbstractResourceTypes(ctx context.Context) ([]string, error)

Jump to

Keyboard shortcuts

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