shared

package
v0.27.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContainerLogPathEnvVar = "RADIUS_CONTAINER_LOG_PATH"
	APIVersion             = "2023-10-01-preview"
	TestNamespace          = "kind-radius"
	AWSDeletionRetryLimit  = 5
)

Variables

This section is empty.

Functions

func K8sSecretResource

func K8sSecretResource(namespace, name, secretType string, kv ...any) unstructured.Unstructured

K8sSecretResource creates the secret resource from the given namespace, name, secretType and key-value pairs, for Initial Resource in NewRPTest().

Types

type RPTest

type RPTest struct {
	Options          RPTestOptions
	Name             string
	Description      string
	InitialResources []unstructured.Unstructured
	Steps            []TestStep
	PostDeleteVerify func(ctx context.Context, t *testing.T, ct RPTest)

	// RequiredFeatures specifies the optional features that are required
	// for this test to run.
	RequiredFeatures []RequiredFeature
}

func NewRPTest

func NewRPTest(t *testing.T, name string, steps []TestStep, initialResources ...unstructured.Unstructured) RPTest

NewRPTest creates a new RPTest instance with the given name, steps and initial resources.

func (RPTest) CheckRequiredFeatures

func (ct RPTest) CheckRequiredFeatures(ctx context.Context, t *testing.T)

CheckRequiredFeatures checks the test environment for the features that the test requires and skips the test if not, otherwise returns an error if there is an issue.

func (RPTest) CleanUpExtensionResources

func (ct RPTest) CleanUpExtensionResources(resources []unstructured.Unstructured)

Method CleanUpExtensionResources deletes all resources in the given slice of unstructured objects.

func (RPTest) CreateInitialResources

func (ct RPTest) CreateInitialResources(ctx context.Context) error

CreateInitialResources creates a namespace and creates initial resources from the InitialResources field of the RPTest struct. It returns an error if either of these operations fail.

func (RPTest) Test

func (ct RPTest) Test(t *testing.T)

type RPTestOptions

type RPTestOptions struct {
	test.TestOptions
	CustomAction     *clientv2.CustomActionClient
	ManagementClient clients.ApplicationsManagementClient
	AWSClient        aws.AWSCloudControlClient

	// Connection gets access to the Radius connection which can be used to create API clients.
	Connection sdk.Connection
}

func NewRPTestOptions

func NewRPTestOptions(t *testing.T) RPTestOptions

NewRPTestOptions sets up the test environment by loading configs, creating a test context, creating an ApplicationsManagementClient, creating an AWSCloudControlClient, and returning an RPTestOptions struct.

type RequiredFeature

type RequiredFeature string

RequiredFeature is used to specify an optional feature that is required for the test to run.

const (
	// FeatureDapr should used with required features to indicate a test dependency
	// on Dapr.
	FeatureDapr RequiredFeature = "Dapr"

	// FeatureCSIDriver should be used with required features to indicate a test dependency
	// on the CSI driver.
	FeatureCSIDriver RequiredFeature = "CSIDriver"
)

type TestOptions

type TestOptions struct {
	test.TestOptions
	DiscoveryClient discovery.DiscoveryInterface
}

func NewTestOptions

func NewTestOptions(t *testing.T) TestOptions

NewTestOptions creates a new TestOptions object with the given testing.T object.

type TestStep

type TestStep struct {
	Executor                               step.Executor
	RPResources                            *validation.RPResourceSet
	K8sOutputResources                     []unstructured.Unstructured
	K8sObjects                             *validation.K8sObjectSet
	AWSResources                           *validation.AWSResourceSet
	PostStepVerify                         func(ctx context.Context, t *testing.T, ct RPTest)
	SkipKubernetesOutputResourceValidation bool
	SkipObjectValidation                   bool
	SkipResourceDeletion                   bool
}

Jump to

Keyboard shortcuts

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