{"modulePath":"github.com/newstack-cloud/celerity/libs/plugin-framework","version":"v0.0.0-20250622144543-e63644f5a9a4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugintestutils\n\n## Variables\n\n```go\nvar Any = anyType{}\n```\nAny is a placeholder value for any value that can be used in assertions for method calls for a value that can be ignored.\n\n## Functions\n\n```go\nfunc CompareTags(\n\tt assert.TestingT,\n\texpectedTags, actualTags []*core.MappingNode,\n\ttagFieldNames *TagFieldNames,\n)\n```\nCompareTags compares two slices of tag MappingNodes in an order-independent way. It extracts key-value pairs represented as an object with attributes holding a key and a value that are both expected to be strings.\n\nIf nil is passed for tagFieldNames, it defaults to using \"key\" and \"value\" as the field names.\n\n```go\nfunc NewTestLinkContext(\n\tproviderConfigMap map[string]map[string]*core.ScalarValue,\n\tcontextVariables map[string]*core.ScalarValue,\n) provider.LinkContext\n```\nNewTestLinkContext creates a provider.LinkContext for testing purposes.\n\n```go\nfunc NewTestProviderContext(\n\tproviderName string,\n\tproviderConfig map[string]*core.ScalarValue,\n\tcontextVariables map[string]*core.ScalarValue,\n) provider.Context\n```\nNewTestProviderContext creates a provider.Context for tests.\n\n```go\nfunc RunLinkChangeStagingTestCases[\n\tResourceAServiceConfig any,\n\tResourceAService any,\n\tResourceBServiceConfig any,\n\tResourceBService any,\n](\n\ttestCases []LinkChangeStagingTestCase[\n\t\tResourceAServiceConfig,\n\t\tResourceAService,\n\t\tResourceBServiceConfig,\n\t\tResourceBService,\n\t],\n\tcreateLink func(\n\t\tlinkServiceDeps pluginutils.LinkServiceDeps[\n\t\t\tResourceAServiceConfig,\n\t\t\tResourceAService,\n\t\t\tResourceBServiceConfig,\n\t\t\tResourceBService,\n\t\t],\n\t) provider.Link,\n\ttestSuite *suite.Suite,\n)\n```\n\n```go\nfunc RunLinkUpdateIntermediaryResourcesTestCases[\n\tResourceAServiceConfig any,\n\tResourceAService any,\n\tResourceBServiceConfig any,\n\tResourceBService any,\n](\n\ttestCases []LinkUpdateIntermediaryResourcesTestCase[\n\t\tResourceAServiceConfig,\n\t\tResourceAService,\n\t\tResourceBServiceConfig,\n\t\tResourceBService,\n\t],\n\tcreateLink func(\n\t\tlinkServiceDeps pluginutils.LinkServiceDeps[\n\t\t\tResourceAServiceConfig,\n\t\t\tResourceAService,\n\t\t\tResourceBServiceConfig,\n\t\t\tResourceBService,\n\t\t],\n\t) provider.Link,\n\ttestSuite *suite.Suite,\n)\n```\nRunLinkUpdateIntermediaryResourcesTestCases runs a set of test cases for the \\`UpdateIntermediaryResources“ methods of a link implementation in a provider plugin.\n\n```go\nfunc RunLinkUpdateResourceTestCases[\n\tResourceAServiceConfig any,\n\tResourceAService any,\n\tResourceBServiceConfig any,\n\tResourceBService any,\n](\n\ttestCases []LinkUpdateResourceTestCase[\n\t\tResourceAServiceConfig,\n\t\tResourceAService,\n\t\tResourceBServiceConfig,\n\t\tResourceBService,\n\t],\n\tcreateLink func(\n\t\tlinkServiceDeps pluginutils.LinkServiceDeps[\n\t\t\tResourceAServiceConfig,\n\t\t\tResourceAService,\n\t\t\tResourceBServiceConfig,\n\t\t\tResourceBService,\n\t\t],\n\t) provider.Link,\n\ttestSuite *suite.Suite,\n)\n```\nRunLinkUpdateResourceTestCases runs a set of test cases for the \\`UpdateResource(A|B)\\` methods of a link implementation in a provider plugin.\n\n```go\nfunc RunResourceDeployTestCases[ServiceConfig any, Service any](\n\ttestCases []ResourceDeployTestCase[ServiceConfig, Service],\n\tcreateResource func(\n\t\tserviceFactory pluginutils.ServiceFactory[ServiceConfig, Service],\n\t\tconfigStore pluginutils.ServiceConfigStore[ServiceConfig],\n\t) provider.Resource,\n\ttestSuite *suite.Suite,\n)\n```\nRunResourceDeployTestCases runs a set of test cases for the \\`Deploy\\` method of a resource implementation in a provider plugin.\n\n```go\nfunc RunResourceDestroyTestCases[ServiceConfig any, Service any](\n\ttestCases []ResourceDestroyTestCase[ServiceConfig, Service],\n\tcreateResource func(\n\t\tserviceFactory pluginutils.ServiceFactory[ServiceConfig, Service],\n\t\tconfigStore pluginutils.ServiceConfigStore[ServiceConfig],\n\t) provider.Resource,\n\ttestSuite *suite.Suite,\n)\n```\nRunResourceDestroyTestCases runs a set of test cases for the \\`Destroy\\` method of a resource implementation in a provider plugin.\n\n```go\nfunc RunResourceGetExternalStateTestCases[ServiceConfig any, Service any](\n\ttestCases []ResourceGetExternalStateTestCase[ServiceConfig, Service],\n\tcreateResource func(\n\t\tserviceFactory pluginutils.ServiceFactory[ServiceConfig, Service],\n\t\tconfigStore pluginutils.ServiceConfigStore[ServiceConfig],\n\t) provider.Resource,\n\ttestSuite *suite.Suite,\n)\n```\nRunResourceGetExternalStateTestCases runs a set of test cases for the \\`GetExternalState\\` method of a resource implementation in a provider plugin.\n\n```go\nfunc RunResourceHasStabilisedTestCases[ServiceConfig any, Service any](\n\ttestCases []ResourceHasStabilisedTestCase[ServiceConfig, Service],\n\tcreateResource func(\n\t\tserviceFactory pluginutils.ServiceFactory[ServiceConfig, Service],\n\t\tconfigStore pluginutils.ServiceConfigStore[ServiceConfig],\n\t) provider.Resource,\n\ttestSuite *suite.Suite,\n)\n```\nRunResourceHasStabilisedTestCases runs a set of test cases for the \\`HasStabilised\\` method of a resource implementation in a provider plugin.\n\n## Types\n\n```go\ntype LinkChangeStagingTestCase[\n\tResourceAServiceConfig any,\n\tResourceAService any,\n\tResourceBServiceConfig any,\n\tResourceBService any,\n] struct {\n\t// The name of the test case used for errors and debugging.\n\tName string\n\t// ServiceFactoryA is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context\n\t// for the first resource (resource A).\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t//\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for AWS services\n\t// and the `Service` type parameter could be a `lambda.Service` interface that implements\n\t// API methods for the AWS Lambda service.\n\t// The `ServiceConfigStore` type parameter would be an optional store\n\tServiceFactoryA pluginutils.ServiceFactory[ResourceAServiceConfig, ResourceAService]\n\t// ServiceFactoryB is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context\n\t// for the second resource (resource B).\n\t//\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for\n\t// AWS services and the `Service` type parameter could be a `lambda.Service`\n\t// interface that implements API methods for the AWS Lambda service.\n\tServiceFactoryB pluginutils.ServiceFactory[ResourceBServiceConfig, ResourceBService]\n\t// ConfigStoreA is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service\n\t// for the first resource (resource A).\n\t// This could be something like a cache for `*aws.Config` for AWS services\n\t// based on a session ID.\n\t// This is only needed if your service factory requires a specific\n\t// configuration struct to be able to create an instance of the service.\n\tConfigStoreA pluginutils.ServiceConfigStore[ResourceAServiceConfig]\n\t// ConfigStoreB is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service\n\t// for the second resource (resource B).\n\tConfigStoreB pluginutils.ServiceConfigStore[ResourceBServiceConfig]\n\t// Input for the link stage changing operation.\n\tInput *provider.LinkStageChangesInput\n\t// Expected output from the link stage changing operation.\n\tExpectedOutput *provider.LinkStageChangesOutput\n\t// If true, the test case expects an error to be returned.\n\tExpectError bool\n\t// The expected error message if an error is expected.\n\t// This doesn't have to be an exact match, the error message\n\t// just needs to contain the provided string.\n\tExpectedErrorMessage string\n}\n```\nLinkChangeStagingTestCase defines a test case for link change staging.\n\n```go\ntype LinkUpdateIntermediaryResourcesTestCase[\n\tResourceAServiceConfig any,\n\tResourceAService any,\n\tResourceBServiceConfig any,\n\tResourceBService any,\n] struct {\n\t// The name of the test case used for errors and debugging.\n\tName string\n\t// ServiceFactoryA is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context\n\t// for the first resource (resource A).\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t//\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for AWS services\n\t// and the `Service` type parameter could be a `lambda.Service` interface that implements\n\t// API methods for the AWS Lambda service.\n\t// The `ServiceConfigStore` type parameter would be an optional store\n\tServiceFactoryA pluginutils.ServiceFactory[ResourceAServiceConfig, ResourceAService]\n\t// ServiceFactoryB is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context\n\t// for the second resource (resource B).\n\t//\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for\n\t// AWS services and the `Service` type parameter could be a `lambda.Service`\n\t// interface that implements API methods for the AWS Lambda service.\n\tServiceFactoryB pluginutils.ServiceFactory[ResourceBServiceConfig, ResourceBService]\n\t// ConfigStoreA is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service\n\t// for the first resource (resource A).\n\t// This could be something like a cache for `*aws.Config` for AWS services\n\t// based on a session ID.\n\t// This is only needed if the service factory for resource A requires a specific\n\t// configuration struct to be able to create an instance of the service.\n\tConfigStoreA pluginutils.ServiceConfigStore[ResourceAServiceConfig]\n\t// ConfigStoreB is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service\n\t// for the second resource (resource B).\n\t// This is only needed if the service factory for resource B requires a specific\n\t// configuration struct to be able to create an instance of the service.\n\tConfigStoreB pluginutils.ServiceConfigStore[ResourceBServiceConfig]\n\t// IntermediariesServiceMockCalls is a mock calls tracker that is expected to be embedded\n\t// into a mock implementation of the service interface for carrying out\n\t// the update operation via the provider service APIs for intermediary resources.\n\tIntermediariesServiceMockCalls *MockCalls\n\t// Input for the link intermediary resources update operation.\n\tInput *provider.LinkUpdateIntermediaryResourcesInput\n\t// Expected output from the link intermediary resources update operation.\n\tExpectedOutput *provider.LinkUpdateIntermediaryResourcesOutput\n\t// UpdateActionsCalled is a mapping of method name to the\n\t// expected second argument for the method.\n\t// When the value is a slice of any, it is expected that the method\n\t// is called multiple times with different arguments in the provided order.\n\t// This will usually be something like a `*Input` or `*Request` struct\n\t// that service library functions take after a context argument.\n\tUpdateActionsCalled map[string]any\n\t// UpdateActionsNotCalled is a list of method names\n\t// that are not expected to be called as a part\n\t// of the update operation.\n\tUpdateActionsNotCalled []string\n\t// If true, the test case expects an error to be returned.\n\tExpectError bool\n\t// The expected error message if an error is expected.\n\t// This doesn't have to be an exact match, the error message\n\t// just needs to contain the provided string.\n\tExpectedErrorMessage string\n}\n```\nLinkUpdateIntermediaryResourcesTestCase defines a test case for updating intermediary resources in a link.\n\n```go\ntype LinkUpdateResource string\n```\nLinkUpdateResource is a type that represents a resource that should be updated in a link update operation.\n\n```go\nconst (\n\t// LinkUpdateResourceA is used to select \"resource A\" in a link\n\t// update operation for testing purposes.\n\tLinkUpdateResourceA LinkUpdateResource = \"resourceA\"\n\t// LinkUpdateResourceB is used to select \"resource B\" in a link\n\t// update operation for testing purposes.\n\tLinkUpdateResourceB LinkUpdateResource = \"resourceB\"\n)\n```\n\n```go\ntype LinkUpdateResourceTestCase[\n\tResourceAServiceConfig any,\n\tResourceAService any,\n\tResourceBServiceConfig any,\n\tResourceBService any,\n] struct {\n\t// The name of the test case used for errors and debugging.\n\tName string\n\t// ServiceFactoryA is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context\n\t// for the first resource (resource A).\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t//\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for AWS services\n\t// and the `Service` type parameter could be a `lambda.Service` interface that implements\n\t// API methods for the AWS Lambda service.\n\t// The `ServiceConfigStore` type parameter would be an optional store\n\tServiceFactoryA pluginutils.ServiceFactory[ResourceAServiceConfig, ResourceAService]\n\t// ServiceFactoryB is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context\n\t// for the second resource (resource B).\n\t//\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for\n\t// AWS services and the `Service` type parameter could be a `lambda.Service`\n\t// interface that implements API methods for the AWS Lambda service.\n\tServiceFactoryB pluginutils.ServiceFactory[ResourceBServiceConfig, ResourceBService]\n\t// ConfigStoreA is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service\n\t// for the first resource (resource A).\n\t// This could be something like a cache for `*aws.Config` for AWS services\n\t// based on a session ID.\n\t// This is only needed if the service factory for resource A requires a specific\n\t// configuration struct to be able to create an instance of the service.\n\tConfigStoreA pluginutils.ServiceConfigStore[ResourceAServiceConfig]\n\t// ConfigStoreB is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service\n\t// for the second resource (resource B).\n\t// This is only needed if the service factory for resource B requires a specific\n\t// configuration struct to be able to create an instance of the service.\n\tConfigStoreB pluginutils.ServiceConfigStore[ResourceBServiceConfig]\n\t// CurrentServiceMockCalls is a mock calls tracker that is expected to be embedded\n\t// into a mock implementation of the service interface for carrying out\n\t// the update operation via the provider service APIs for the resource\n\t// under test.\n\tCurrentServiceMockCalls *MockCalls\n\t// Input for the link resource update operation.\n\tInput *provider.LinkUpdateResourceInput\n\t// Expected output from the link resource update operation.\n\tExpectedOutput *provider.LinkUpdateResourceOutput\n\t// Resource defines the resource in the link relationship that should be updated.\n\tResource LinkUpdateResource\n\t// UpdateActionsCalled is a mapping of method name to the\n\t// expected second argument for the method.\n\t// When the value is a slice of any, it is expected that the method\n\t// is called multiple times with different arguments in the provided order.\n\t// This will usually be something like a `*Input` or `*Request` struct\n\t// that service library functions take after a context argument.\n\tUpdateActionsCalled map[string]any\n\t// UpdateActionsNotCalled is a list of method names\n\t// that are not expected to be called as a part\n\t// of the update operation.\n\tUpdateActionsNotCalled []string\n\t// If true, the test case expects an error to be returned.\n\tExpectError bool\n\t// The expected error message if an error is expected.\n\t// This doesn't have to be an exact match, the error message\n\t// just needs to contain the provided string.\n\tExpectedErrorMessage string\n}\n```\nLinkUpdateResourceTestCase defines a test case for link resource update operations.\n\n```go\ntype MockCalls struct {\n\t// contains filtered or unexported fields\n}\n```\nMockCalls is a lightweight test helper for tracking calls to methods in a mock implementation of an upstream provider service interface. This can be embedded in a service-specific mock struct to track calls to methods and make assertions on them in tests. This struct is safe for concurrent use when multiple calls are made across goroutines at the same time.\n\nExample:\n\n\ttype MyServiceMock struct {\n\t    MockCalls\n\t    // Other fields specific to the mock service\n\t}\n\n\t// Other methods specific to the mock service\n\n\tfunc (m *MyServiceMock) MyMethod(arg1 string, arg2 int) {\n\t    m.RegisterCall(arg1, arg2)\n\t    // Implementation of the method\n\t}\n\n```go\nfunc (m *MockCalls) AssertCalled(s *suite.Suite, methodName string)\n```\nAssertCalled asserts that a method with the given name was called at least once.\n\n```go\nfunc (m *MockCalls) AssertCalledWith(s *suite.Suite, methodName string, callIndex int, args ...any)\n```\nAssertCalledWith asserts that a method with the given name was called with the specific arguments for the provided call index (callNumber - 1).\n\n```go\nfunc (m *MockCalls) AssertNotCalled(s *suite.Suite, methodName string)\n```\nAssertNotCalled asserts that a method with the given name was not called. This is useful to ensure that a method was not invoked during a test.\n\n```go\nfunc (m *MockCalls) RegisterCall(args ...any)\n```\nRegisterCall registers a call for the current method with the given arguments.\n\n```go\nfunc (m *MockCalls) RegisterNamedCall(methodName string, args ...any)\n```\nRegisterNamedCall registers a call to a method with the given name.\n\n```go\ntype ResourceDeployTestCase[ServiceConfig any, Service any] struct {\n\t// Name is the name of the test case that will be used when running a test suite.\n\tName string\n\t// ServiceFactory is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context.\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t//\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for AWS services\n\t// and the `Service` type parameter could be a `lambda.Service` interface that implements\n\t// API methods for the AWS Lambda service.\n\t// The `ServiceConfigStore` type parameter would be an optional store\n\tServiceFactory pluginutils.ServiceFactory[ServiceConfig, Service]\n\t// ServiceMockCalls is a mock calls tracker that is expected to be embedded\n\t// into a mock implementation of the service interface for carrying out\n\t// the save operation via the provider service APIs.\n\tServiceMockCalls *MockCalls\n\t// ConfigStore is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service.\n\t// This could be something like a cache for `*aws.Config` for AWS services\n\t// based on a session ID.\n\t// This is only needed if your service factory requires a specific\n\t// configuration struct to be able to create an instance of the service.\n\tConfigStore pluginutils.ServiceConfigStore[ServiceConfig]\n\t// Input is passed into the `Deploy` method of the resource implementation.\n\tInput *provider.ResourceDeployInput\n\t// SaveActionsCalled is a mapping of method name to the\n\t// expected second argument for the method.\n\t// When the value is a slice of any, it is expected that the method\n\t// is called multiple times with different arguments in the provided order.\n\t// This will usually be something like a `*Input` or `*Request` struct\n\t// that service library functions take after a context argument.\n\tSaveActionsCalled map[string]any\n\t// SaveActionsNotCalled is a list of method names\n\t// that are not expected to be called as a part\n\t// of the save operation.\n\tSaveActionsNotCalled []string\n\t// ExpectedOutput is the expected output from the `Deploy` method.\n\tExpectedOutput *provider.ResourceDeployOutput\n\t// ExpectError indicates whether the test case expects an error\n\t// to be returned from the `Deploy` method.\n\tExpectError bool\n}\n```\nResourceDeployTestCase defines a test case for the \\`Deploy\\` method of a resource implementation in a provider plugin. This is used to test both creation and update operations which may be two separate methods depending on the provider plugin implementation.\n\nFor resources defined with the \\`providerv1.ResourceDefinition\\` helper struct, this test case will be used to test both \\`Create\\` and \\`Update\\` methods as the \\`Deploy\\` method in the helper struct will determine the appropriate action to take based on the deploy input.\n\n```go\ntype ResourceDestroyTestCase[ServiceConfig any, Service any] struct {\n\t// Name is the name of the test case that will be used when running a test suite.\n\tName string\n\t// ServiceFactory is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context.\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t//\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for AWS services\n\t// and the `Service` type parameter could be a `lambda.Service` interface that implements\n\t// API methods for the AWS Lambda service.\n\t// The `ServiceConfigStore` type parameter would be an optional store\n\tServiceFactory pluginutils.ServiceFactory[ServiceConfig, Service]\n\t// ServiceMockCalls is a mock calls tracker that is expected to be embedded\n\t// into a mock implementation of the service interface for carrying out\n\t// the destroy operation via the provider service APIs.\n\tServiceMockCalls *MockCalls\n\t// ConfigStore is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service.\n\t// This could be something like a cache for `*aws.Config` for AWS services\n\t// based on a session ID.\n\t// This is only needed if your service factory requires a specific\n\t// configuration struct to be able to create an instance of the service.\n\tConfigStore pluginutils.ServiceConfigStore[ServiceConfig]\n\t// Input is passed into the `Destroy` method of the resource implementation.\n\tInput *provider.ResourceDestroyInput\n\t// DestroyActionsCalled is a mapping of method name to the\n\t// expected second argument for the method.\n\t// When the value is a slice of any, it is expected that the method\n\t// is called multiple times with different arguments in the provided order.\n\t// This will usually be something like a `*Input` or `*Request` struct\n\t// that service library functions take after a context argument.\n\tDestroyActionsCalled map[string]any\n\t// SaveActionsNotCalled is a list of method names\n\t// that are not expected to be called as a part\n\t// of the save operation.\n\tDestroyActionsNotCalled []string\n\t// ExpectError indicates whether the test case expects an error\n\t// to be returned from the `Destroy` method.\n\tExpectError bool\n}\n```\nResourceDestroyTestCase defines a test case for the \\`Destroy\\` method of a resource implementation in a provider plugin. This is used to test both creation and update operations which may be two separate methods depending on the provider plugin implementation.\n\n```go\ntype ResourceGetExternalStateTestCase[ServiceConfig any, Service any] struct {\n\t// Name is the name of the test case that will be used when running a test suite.\n\tName string\n\t// ServiceFactory is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context.\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t//\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for AWS services\n\t// and the `Service` type parameter could be a `lambda.Service` interface that implements\n\t// API methods for the AWS Lambda service.\n\t// The `ServiceConfigStore` type parameter would be an optional store\n\tServiceFactory pluginutils.ServiceFactory[ServiceConfig, Service]\n\t// ConfigStore is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service.\n\t// This could be something like a cache for `*aws.Config` for AWS services\n\t// based on a session ID.\n\t// This is only needed if your service factory requires a specific\n\t// configuration struct to be able to create an instance of the service.\n\tConfigStore pluginutils.ServiceConfigStore[ServiceConfig]\n\t// Input is the input passed into the `GetExternalState` method.\n\tInput *provider.ResourceGetExternalStateInput\n\t// ExpectedOutput is the expected output from the `GetExternalState` method.\n\tExpectedOutput *provider.ResourceGetExternalStateOutput\n\t// CheckTags should be set to true if the subject resource holds tags\n\t// as an array of key-value pair objects.\n\t// The default behaviour is to not check tags.\n\tCheckTags bool\n\t// TagsFieldName is the name of the field in the resource spec state\n\t// that holds the tags as an array of key-value pair objects.\n\t// This field is used only if CheckTags is `true`.\n\t// The default value is \"tags\".\n\tTagsFieldName string\n\t// TagObjectFieldNames is used to specify the field names for keys and values\n\t// for tags in the resource spec state.\n\t// The default field names are \"key\" and \"value\", this will only\n\t// be used if CheckTags is `true`.\n\tTagObjectFieldNames *TagFieldNames\n\t// ExpectError indicates whether the test case expects an error\n\t// to be returned from the `GetExternalState` method.\n\tExpectError bool\n}\n```\nResourceGetExternalStateTestCase defines a test case for \\`GetExternalState\\` method of a resource implementation in a provider plugin.\n\n```go\ntype ResourceHasStabilisedTestCase[ServiceConfig any, Service any] struct {\n\t// Name is the name of the test case that will be used when running a test suite.\n\tName string\n\t// ServiceFactory is a function that creates an instance of the service\n\t// using the provided service-specific configuration and a provider context.\n\t// serviceConfig can be nil for services that do not take a specific configuration\n\t// to create client instances.\n\t//\n\t// For example the `ServiceConfig` type parameter would be `*aws.Config` for AWS services\n\t// and the `Service` type parameter could be a `lambda.Service` interface that implements\n\t// API methods for the AWS Lambda service.\n\t// The `ServiceConfigStore` type parameter would be an optional store\n\tServiceFactory pluginutils.ServiceFactory[ServiceConfig, Service]\n\t// ConfigStore is a store that generates service-specific configuration\n\t// for the service factory to create an instance of the service.\n\t// This could be something like a cache for `*aws.Config` for AWS services\n\t// based on a session ID.\n\t// This is only needed if your service factory requires a specific\n\t// configuration struct to be able to create an instance of the service.\n\tConfigStore pluginutils.ServiceConfigStore[ServiceConfig]\n\t// Input is the input passed into the `HasStabilised` method.\n\tInput *provider.ResourceHasStabilisedInput\n\t// ExpectedOutput is the expected output from the `HasStabilised` method.\n\tExpectedOutput *provider.ResourceHasStabilisedOutput\n\t// ExpectError indicates whether the test case expects an error\n\t// to be returned from the `GetExternalState` method.\n\tExpectError bool\n}\n```\nResourceHasStabilisedTestCase defines a test case for \\`HasStabilised\\` method of a resource implementation in a provider plugin.\n\n```go\ntype TagFieldNames struct {\n\tKeyFieldName   string\n\tValueFieldName string\n}\n```\nTagFieldNames holds the field names used to extract key and value from tag slice MappingNodes. By default, if empty or the values are not set when passed to CompareTags, it will use \"key\" and \"value\" as the field names.\n\n","path":"github.com/newstack-cloud/celerity/libs/plugin-framework/sdk/plugintestutils","name":"plugintestutils","synopsis":"","isRedistributable":true}
