funcs

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package funcs contains convenience functions for working with e2e-framework environments and feature tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCrossplaneTypesToScheme

func AddCrossplaneTypesToScheme() env.Func

AddCrossplaneTypesToScheme adds Crossplane's core custom resource's to the environment's scheme. This allows the environment's client to work with said types.

func AllOf

func AllOf(fns ...features.Func) features.Func

AllOf runs the supplied functions in order.

func ApplyHandler

func ApplyHandler(r *resources.Resources, manager string) decoder.HandlerFunc

ApplyHandler is a decoder.Handler that uses server-side apply to apply the supplied object.

func ApplyResources

func ApplyResources(manager, dir, pattern string) features.Func

ApplyResources applies all manifests under the supplied directory that match the supplied glob pattern (e.g. *.yaml). It uses server-side apply - fields are managed by the supplied field manager. It fails the test if any supplied resource cannot be applied successfully.

func AsFeaturesFunc

func AsFeaturesFunc(fn env.Func) features.Func

AsFeaturesFunc converts an env.Func to a features.Func. If the env.Func returns an error the calling test is failed with t.Fatal(err).

func CRDInitialNamesAccepted

func CRDInitialNamesAccepted() xpv1.Condition

CRDInitialNamesAccepted is the status condition CRDs emit when they're established. Most of our Crossplane status conditions are defined elsewhere (e.g. in the xpv1 package), but this isn't so we define it here for convenience.

func CopyImageToRegistry

func CopyImageToRegistry(clusterName, ns, sName, image string, timeout time.Duration) features.Func

CopyImageToRegistry tries to copy the supplied image to the supplied registry within the timeout

func CreateKindClusterWithConfig

func CreateKindClusterWithConfig(clusterName, configFilePath string) env.Func

CreateKindClusterWithConfig create kind cluster of the given name according to configuration referred via configFilePath. The configuration is placed in test context afterward

func DeleteResources

func DeleteResources(dir, pattern string) features.Func

DeleteResources deletes (from the environment) all resources defined by the manifests under the supplied directory that match the supplied glob pattern (e.g. *.yaml).

func DeploymentBecomesAvailableWithin

func DeploymentBecomesAvailableWithin(d time.Duration, namespace, name string) features.Func

DeploymentBecomesAvailableWithin fails a test if the supplied Deployment is not Available within the supplied duration.

func EnvFuncs

func EnvFuncs(fns ...env.Func) env.Func

EnvFuncs runs the supplied functions in order, returning the first error.

func FilterByGK

func FilterByGK(gk schema.GroupKind) func(o k8s.Object) bool

FilterByGK returns a filter function that returns true if the supplied object is of the supplied GroupKind.

func HelmInstall

func HelmInstall(o ...helm.Option) env.Func

HelmInstall installs a Helm chart.

func HelmRepo

func HelmRepo(o ...helm.Option) env.Func

HelmRepo manages a Helm repo.

func HelmUninstall

func HelmUninstall(o ...helm.Option) env.Func

HelmUninstall uninstalls a Helm chart.

func HelmUpgrade

func HelmUpgrade(o ...helm.Option) env.Func

HelmUpgrade upgrades a Helm chart.

func ManagedResourcesOfClaimHaveFieldValueWithin

func ManagedResourcesOfClaimHaveFieldValueWithin(d time.Duration, dir, file, path string, want any, filter func(object k8s.Object) bool) features.Func

ManagedResourcesOfClaimHaveFieldValueWithin fails a test if the managed resources created by the claim does not have the supplied value at the supplied path within the supplied duration.

func ReadyToTestWithin

func ReadyToTestWithin(d time.Duration, namespace string) features.Func

ReadyToTestWithin fails a test if Crossplane is not ready to test within the supplied duration. It's typically called in a feature's Setup function. Its purpose isn't to test that Crossplane installed successfully (we have a specific test for that). Instead its purpose is to make sure tests don't start before Crossplane has finished installing.

func ResourceCreatedWithin

func ResourceCreatedWithin(d time.Duration, o k8s.Object) features.Func

ResourceCreatedWithin fails a test if the supplied resource is not found to exist within the supplied duration.

func ResourceDeletedWithin

func ResourceDeletedWithin(d time.Duration, o k8s.Object) features.Func

ResourceDeletedWithin fails a test if the supplied resource is not deleted within the supplied duration.

func ResourceHasFieldValueWithin

func ResourceHasFieldValueWithin(d time.Duration, o k8s.Object, path string, want any) features.Func

ResourceHasFieldValueWithin fails a test if the supplied resource does not have the supplied value at the supplied field path within the supplied duration. The supplied 'want' value must cmp.Equal the actual value.

func ResourcesCreatedWithin

func ResourcesCreatedWithin(d time.Duration, dir, pattern string) features.Func

ResourcesCreatedWithin fails a test if the supplied resources are not found to exist within the supplied duration.

func ResourcesDeletedWithin

func ResourcesDeletedWithin(d time.Duration, dir, pattern string) features.Func

ResourcesDeletedWithin fails a test if the supplied resources are not deleted within the supplied duration.

func ResourcesFailToApply

func ResourcesFailToApply(manager, dir, pattern string) features.Func

ResourcesFailToApply applies all manifests under the supplied directory that match the supplied glob pattern (e.g. *.yaml). It uses server-side apply - fields are managed by the supplied field manager. It fails the test if any supplied resource _can_ be applied successfully - use it to test that the API server should reject a resource.

func ResourcesHaveConditionWithin

func ResourcesHaveConditionWithin(d time.Duration, dir, pattern string, cds ...xpv1.Condition) features.Func

ResourcesHaveConditionWithin fails a test if the supplied resources do not have (i.e. become) the supplied conditions within the supplied duration.

func ResourcesHaveFieldValueWithin

func ResourcesHaveFieldValueWithin(d time.Duration, dir, pattern, path string, want any) features.Func

ResourcesHaveFieldValueWithin fails a test if the supplied resources do not have the supplied value at the supplied field path within the supplied duration. The supplied 'want' value must cmp.Equal the actual value.

func ServiceIngressEndPoint

func ServiceIngressEndPoint(ctx context.Context, cfg *envconf.Config, clusterName, namespace, serviceName string) (string, error)

ServiceIngressEndPoint returns endpoint (addr:port) that can be used for accessing the service in the cluster with the given name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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