Documentation
¶
Index ¶
- Constants
- func NewCosmosCRUD[InternalAPIType any, ...](t *testing.T, cosmosClient database.ResourcesDBClient, ...) database.ResourceCRUD[InternalAPIType, InternalAPITypePointer]
- func NewCosmosCompareStep(stepID StepID, stepDir fs.FS) (*cosmosCompare, error)
- func NewFrontendHTTPTestAccessor(frontEndURL string, frontendClient *hcpsdk20240610preview.ClientFactory) *frontendHTTPTestAccessor
- func NewKubernetesApplyStep(stepID StepID, stepDir fs.FS) (*kubernetesApplyStep, error)
- func NewKubernetesCompareStep(stepID StepID, stepDir fs.FS) (*kubernetesCompareStep, error)
- func NewKubernetesLoadStep(stepID StepID, stepDir fs.FS) (*kubernetesLoadStep, error)
- func NewLoadClusterServiceStep(stepID StepID, clusterServiceContent fs.FS) (*loadClusterServiceStep, error)
- func NewLoadCosmosStep(stepID StepID, stepDir fs.FS) (*loadCosmosStep, error)
- func NewVersionedHTTPTestAccessor(url, apiVersion string) *httpHTTPTestAccessor
- func ResourceInstanceEquals(t *testing.T, expected, actual any) (string, bool)
- func ResourceName(resource any) string
- type CosmosCRUDKey
- type CosmosItemKey
- type GetByIDCRUDKey
- type HTTPTestAccessor
- type IntegrationTestStep
- type OperationAccessor
- type ResourceKey
- type ResourceMutationTest
- type ResourceType
- type StepID
- type StepInput
- type UntypedCRUDKey
- type UntypedChild
- type UntypedItemKey
Constants ¶
const DefaultTestAPIVersion = "2024-06-10-preview"
DefaultTestAPIVersion is the API version used by existing integration tests. When a new API version becomes the default, update this constant and fix any test fixture response differences.
Variables ¶
This section is empty.
Functions ¶
func NewCosmosCRUD ¶
func NewCosmosCRUD[InternalAPIType any, InternalAPITypePointer arm.CosmosMetadataAccessorPtr[InternalAPIType]](t *testing.T, cosmosClient database.ResourcesDBClient, parentResourceID *azcorearm.ResourceID, resourceType azcorearm.ResourceType) database.ResourceCRUD[InternalAPIType, InternalAPITypePointer]
func NewCosmosCompareStep ¶
func NewFrontendHTTPTestAccessor ¶
func NewFrontendHTTPTestAccessor(frontEndURL string, frontendClient *hcpsdk20240610preview.ClientFactory) *frontendHTTPTestAccessor
func NewKubernetesApplyStep ¶
func NewKubernetesLoadStep ¶
func NewLoadCosmosStep ¶
func NewVersionedHTTPTestAccessor ¶
func NewVersionedHTTPTestAccessor(url, apiVersion string) *httpHTTPTestAccessor
NewVersionedHTTPTestAccessor creates an HTTP test accessor that sends requests with the given api-version query parameter and the required ARM headers.
func ResourceInstanceEquals ¶
func ResourceName ¶
Types ¶
type CosmosCRUDKey ¶
type CosmosCRUDKey struct {
ParentResourceID *azcorearm.ResourceID `json:"parentResourceId"`
ResourceType ResourceType `json:"resourceType"`
}
type CosmosItemKey ¶
type CosmosItemKey struct {
ResourceID *azcorearm.ResourceID `json:"resourceId"`
}
type GetByIDCRUDKey ¶
type GetByIDCRUDKey struct {
CosmosCRUDKey `json:",inline"`
CosmosID string `json:"cosmosID"`
}
type HTTPTestAccessor ¶
type HTTPTestAccessor interface {
Get(ctx context.Context, resourceIDString string) (any, error)
List(ctx context.Context, parentResourceIDString string) ([]any, error)
CreateOrUpdate(ctx context.Context, resourceIDString string, content []byte) error
Post(ctx context.Context, resourceIDString string, content []byte) error
Patch(ctx context.Context, resourceIDString string, content []byte) error
Delete(ctx context.Context, resourceIDString string) error
}
type IntegrationTestStep ¶
type IntegrationTestStep interface {
StepID() StepID
RunTest(ctx context.Context, t *testing.T, stepInput StepInput)
}
func NewStep ¶
func NewStep[InternalAPIType any, InternalAPITypePointer arm.CosmosMetadataAccessorPtr[InternalAPIType]](indexString, stepType, stepName string, testDir fs.FS, path string) (IntegrationTestStep, error)
func NewUntypedStep ¶
func NewUntypedStep(indexString, stepType, stepName string, testDir fs.FS, path string) (IntegrationTestStep, error)
NewUntypedStep dispatches step types that don't require a typed CRUD client. Returns an error for any step kind that needs an InternalAPIType (create, replace, get, getByID, list, delete, replaceWithETag) — those must go through NewStep.
type OperationAccessor ¶
type ResourceKey ¶
type ResourceKey struct {
ResourceID string `json:"resourceId"`
// APIVersion specifies the ARM api-version query parameter for HTTP operations.
// Valid values are ARM API version strings (e.g., "2024-06-10-preview", "2025-12-23-preview").
// If empty, falls back to StepInput.APIVersion, then DefaultTestAPIVersion.
// Only used by HTTP step types; non-HTTP steps (e.g., completeOperation) ignore this field.
APIVersion string `json:"apiVersion,omitempty"`
}
ResourceKey identifies an ARM resource for test step operations. Used by HTTP step types (httpCreate, httpGet, httpPost, httpPatch, httpDelete, httpList) and by completeOperation (which uses only ResourceID).
type ResourceMutationTest ¶
type ResourceMutationTest struct {
// contains filtered or unexported fields
}
func NewResourceMutationTest ¶
func NewUntypedResourceMutationTest ¶
func NewUntypedResourceMutationTest(ctx context.Context, testName string, testDir fs.FS, withMock bool) (*ResourceMutationTest, error)
NewUntypedResourceMutationTest builds a ResourceMutationTest whose step dispatch only knows about untyped step kinds (load, untyped*, http*, etc). The typed CRUD step constructors (create/replace/get/list/...) require a CosmosMetadataAccessor pointer constraint that the raw TypedDocument used for UntypedCRUD suites doesn't satisfy, so we route that suite through this constraint-free path.
func (*ResourceMutationTest) RunTest ¶
func (tt *ResourceMutationTest) RunTest(t *testing.T)
type ResourceType ¶
type ResourceType struct {
azcorearm.ResourceType
}
func (*ResourceType) MarshalText ¶
func (o *ResourceType) MarshalText() ([]byte, error)
MarshalText returns a textual representation of the ResourceID
func (*ResourceType) UnmarshalText ¶
func (o *ResourceType) UnmarshalText(text []byte) error
UnmarshalText decodes the textual representation of a ResourceID
type StepInput ¶
type StepInput struct {
CosmosContainer *azcosmos.ContainerClient
ContentLoader integrationutils.ContentLoader
DocumentLister integrationutils.DocumentLister
ResourcesDBClient database.ResourcesDBClient
FrontendURL string
AdminURL string
APIVersion string
ClusterServiceMockInfo *integrationutils.ClusterServiceMock
KubeFakeClientSets *integrationutils.KubernetesClientSets
}
func NewCosmosStepInput ¶
func NewCosmosStepInput(storageInfo integrationutils.StorageIntegrationTestInfo) *StepInput
func (StepInput) HTTPTestAccessor ¶
func (s StepInput) HTTPTestAccessor(key ResourceKey) HTTPTestAccessor
type UntypedCRUDKey ¶
type UntypedCRUDKey struct {
CosmosCRUDKey `json:",inline"`
Descendents []UntypedChild `json:"descendents"`
}
type UntypedChild ¶
type UntypedItemKey ¶
type UntypedItemKey struct {
ResourceID string `json:"resourceId"`
}
Source Files
¶
- http_test_accessor.go
- per_resource_comparer.go
- per_resource_crud.go
- per_resource_http.go
- per_resource_operation.go
- resource_crud_test_util.go
- step_cluster_service_compare.go
- step_completeoperation.go
- step_cosmoscompare.go
- step_create.go
- step_delete.go
- step_get.go
- step_getbyid.go
- step_httpcreate.go
- step_httpdelete.go
- step_httpget.go
- step_httplist.go
- step_httppatch.go
- step_httppost.go
- step_kubernetes_apply.go
- step_kubernetes_compare.go
- step_kubernetes_load.go
- step_list.go
- step_list_active_operations.go
- step_load_clusterservice.go
- step_load_cosmos.go
- step_migrate_cosmos.go
- step_replace.go
- step_replace_with_etag.go
- step_set_cluster_service_id.go
- step_sync_cluster_cluster_service_update_dispatch.go
- step_untypeddelete.go
- step_untypedget.go
- step_untypedlist.go
- step_untypedlistrecursive.go