integration

package
v1.14.0 Latest Latest
Warning

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

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

README

Integration Tests

This folder contains the integration tests and their utilities of the project.

These tests here are primarily used to test the Addon Operator itself and it's interaction with Kubernetes/OpenShift and OLM.

Previously these tests where named e2e-tests, but we choose to rename them, because the real end to end tests are done with osde2e and OCM.

Documentation

Overview

Package integration contains the Addon Operator integration tests.

Index

Constants

View Source
const (
	OCMAPIEndpoint = "http://api-mock.api-mock.svc.cluster.local"
)

Variables

View Source
var (
	// Client pointing to the e2e test cluster.
	Client    client.Client
	Config    *rest.Config
	Scheme    = runtime.NewScheme()
	Cv        *configv1.ClusterVersion
	OCMClient *ocm.Client
	// Namespace that the Addon Operator is running in.
	// Needs to be auto-discovered, because OpenShift CI is installing the Operator in a non deterministic namespace.
	AddonOperatorNamespace string

	// Typed K8s Clients
	CoreV1Client corev1client.CoreV1Interface
)

Functions

func ExecCommandInPod added in v0.7.0

func ExecCommandInPod(namespace string, pod string, container string, command []string) (string, string, error)

func InitOCMClient added in v1.3.0

func InitOCMClient() error

func PrintPodStatusAndLogs

func PrintPodStatusAndLogs(namespace string) error

Prints the phase of a pod together with the logs of every container.

func RunAPIServerProxy added in v0.7.0

func RunAPIServerProxy(closeCh <-chan struct{}) error

Runs a local apiserver proxy on 127.0.0.1:8001 similar to `kubectl proxy`.

func WaitForFreshAddonCondition added in v0.7.0

func WaitForFreshAddonCondition(
	t *testing.T, timeout time.Duration,
	a *addonsv1alpha1.Addon, conditionType string, conditionStatus metav1.ConditionStatus,
) error

Wait for an up-to-date condition value on an addon. A condition is considered up-to-date when it's .ObservedGeneration matches the generation of it's addon object.

func WaitForObject

func WaitForObject(
	ctx context.Context,
	t *testing.T, timeout time.Duration,
	object client.Object, reason string,
	checkFn func(obj client.Object) (done bool, err error),
) error

Wait that something happens with an object.

func WaitForObjectWithInterval added in v1.13.0

func WaitForObjectWithInterval(
	ctx context.Context,
	t *testing.T, interval time.Duration, timeout time.Duration,
	object client.Object, reason string,
	checkFn func(obj client.Object) (done bool, err error),
) error

func WaitToBeGone

func WaitToBeGone(ctx context.Context, t *testing.T, timeout time.Duration, object client.Object) error

WaitToBeGone blocks until the given object is gone from the kubernetes API server.

Types

This section is empty.

Jump to

Keyboard shortcuts

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