test

package
v1.36.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCertSecret

func CreateCertSecret(name, namespace string, dnsNames ...string) *corev1.Secret

CreateCertSecret creates a secret that is not signed by the certificate manager, making it useful for testing legacy operator secrets or secrets that are brought to the cluster by the customer.

func CreateCertSecretWithContent added in v1.35.1

func CreateCertSecretWithContent(name, namespace string, keyContent []byte, crtContent []byte) *corev1.Secret

func ExpectBundleContents added in v1.34.0

func ExpectBundleContents(bundle *corev1.ConfigMap, secrets ...types.NamespacedName)

func ExpectEnv

func ExpectEnv(env []v1.EnvVar, key, value string)

func ExpectGlobalAlertTemplateToBePopulated

func ExpectGlobalAlertTemplateToBePopulated(resource runtime.Object)

func ExpectGlobalReportType

func ExpectGlobalReportType(resource runtime.Object, name string)

func ExpectK8sServiceEpEnvVars

func ExpectK8sServiceEpEnvVars(podSpec corev1.PodSpec, host, port string)

func ExpectNoK8sServiceEpEnvVars added in v1.22.0

func ExpectNoK8sServiceEpEnvVars(podSpec corev1.PodSpec)

func ExpectResource

func ExpectResource(expected client.Object, resources []client.Object) error

ExpectResource checks that the given list of resources contains a resource with the given name and namespace, and that the resource has the given GroupVersionKind.

func ExpectResourceInList added in v1.19.0

func ExpectResourceInList(objs []client.Object, name, ns, group, version, kind string)

func ExpectResourceTypeAndObjectMetadata added in v1.32.0

func ExpectResourceTypeAndObjectMetadata(resource runtime.Object, name, ns, group, version, kind string)

ExpectResourceTypeAndObjectMetadata checks that the given resource matches the expected name, namespace, group, version, and kind. Note that this function often results in tests that are brittle and subject to breakages when resource ordering changes, and are also hard to debug. most tests should use ExpectResources instead, which is more robust and provides better error messages. Use this function only when the order of resources is actually important.

func ExpectResources added in v1.32.0

func ExpectResources(resources []client.Object, expected []client.Object)

ExpectResources checks that the given list of resources contains the expected resources, and that the given resource list does not contain any unexpected resources.

func ExpectVolumeMount added in v1.25.2

func ExpectVolumeMount(vms []v1.VolumeMount, name, path string)

func GetContainer

func GetContainer(containers []v1.Container, name string) *v1.Container

func GetGlobalResource added in v1.30.0

func GetGlobalResource(resources []client.Object, name, group, version, kind string) client.Object

func GetResource

func GetResource(resources []client.Object, name, ns, group, version, kind string) client.Object

GetResource returns the resource with the given name, namespace, group, version, and kind from the given list of resources.

func GetResourceOfType added in v1.34.0

func GetResourceOfType[T client.Object](resources []client.Object, name, ns string) (T, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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