fixture

package
v1.17.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// E2ETestLabelsKey and E2ETestLabelsValue are added to cluster-scoped resources (e.g. Namespaces) created by E2E tests (where possible). On startup (and before each test for sequential tests), any resources with this label will be deleted.
	E2ETestLabelsKey   = "app"
	E2ETestLabelsValue = "test-argo-app"
)

Variables

Functions

func CreateManagedNamespace

func CreateManagedNamespace(name string, managedByNamespace string) *corev1.Namespace

Create a namespace 'name' that is managed by another namespace 'managedByNamespace', via managed-by label.

func CreateManagedNamespaceWithCleanupFunc

func CreateManagedNamespaceWithCleanupFunc(name string, managedByNamespace string) (*corev1.Namespace, func())

func CreateNamespace

func CreateNamespace(name string) *corev1.Namespace

Create namespace for tests having a specific label for identification - If the namespace already exists, it will be deleted first

func CreateNamespaceWithCleanupFunc

func CreateNamespaceWithCleanupFunc(name string) (*corev1.Namespace, func())

func CreateRandomE2ETestNamespace

func CreateRandomE2ETestNamespace() *corev1.Namespace

func CreateRandomE2ETestNamespaceWithCleanupFunc

func CreateRandomE2ETestNamespaceWithCleanupFunc() (*corev1.Namespace, func())

func EnsureParallelCleanSlate

func EnsureParallelCleanSlate()

func EnsureSequentialCleanSlate

func EnsureSequentialCleanSlate()

EnsureSequentialCleanSlate will clean up resources that were created during previous sequential tests - Deletes namespaces that were created by previous tests - Deletes other cluster-scoped resources that were created - Reverts changes made to Subscription CR - etc

func EnsureSequentialCleanSlateWithError

func EnsureSequentialCleanSlateWithError() error

func EnvCI

func EnvCI() bool

EnvCI checks if CI env var is set; this variable is set when testing on GitOps Operator running via CI pipeline (and using an OLM Subscription)

func EnvLocalRun

func EnvLocalRun() bool

func EnvNonOLM

func EnvNonOLM() bool

EnvNonOLM checks if NON_OLM var is set; this variable is set when testing on GitOps operator that is not installed via OLM

func GetEnvInOperatorSubscriptionOrDeployment

func GetEnvInOperatorSubscriptionOrDeployment(key string) (*string, error)

GetEnvInOperatorSubscriptionOrDeployment will return the value of an environment variable, in either operator Subscription or operator Deployment, depending on which mode the test is running in.

func GetSubscriptionInEnvCIEnvironment

func GetSubscriptionInEnvCIEnvironment(k8sClient client.Client) (*olmv1alpha1.Subscription, error)

func OutputDebugOnFail

func OutputDebugOnFail(namespaceParams ...any)

OutputDebugOnFail can be used to debug a failing test: it will output the operator logs and namespace info Parameters: - Will output debug information on namespaces specified as parameters. - Namespace parameter may be a string, *Namespace, or Namespace

func RemoveDynamicPluginFromCSV

func RemoveDynamicPluginFromCSV(ctx context.Context, k8sClient client.Client) error

RemoveDynamicPluginFromCSV ensures that if the CSV in 'openshift-gitops-operator' NS exists, that the CSV does not contain the dynamic plugin env var

func RemoveEnvFromOperatorSubscriptionOrDeployment

func RemoveEnvFromOperatorSubscriptionOrDeployment(key string) error

RemoveEnvFromOperatorSubscriptionOrDeployment will delete an environment variable from either operator Subscription or operator Deployment, depending on which mode the test is running in.

func RestoreSubcriptionToDefault

func RestoreSubcriptionToDefault() error

RestoreSubcriptionToDefault ensures that the Subscription (or Deployment env vars) are restored to a default state before each test.

func SetEnvInOperatorSubscriptionOrDeployment

func SetEnvInOperatorSubscriptionOrDeployment(key string, value string)

SetEnvInOperatorSubscriptionOrDeployment will set the value of an environment variable, in either operator Subscription (under .spec.config.env) or operator Deployment (under template spec), depending on which mode the test is running in.

func WaitForAllDeploymentsInTheNamespaceToBeReady

func WaitForAllDeploymentsInTheNamespaceToBeReady(ns string, k8sClient client.Client)

func WaitForAllPodsInTheNamespaceToBeReady

func WaitForAllPodsInTheNamespaceToBeReady(ns string, k8sClient client.Client)

func WaitForAllStatefulSetsInTheNamespaceToBeReady

func WaitForAllStatefulSetsInTheNamespaceToBeReady(ns string, k8sClient client.Client)

Types

This section is empty.

Jump to

Keyboard shortcuts

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