test

package
v0.0.0-...-fad0b5e Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteObject

func DeleteObject(ctx context.Context, k8sClient client.Client, obj client.Object)

func MockComponent

func MockComponent(
	ctx context.Context,
	name, namespace string,
	options *MockComponentOptions,
) *v1alpha1.Component

func MockResource

func MockResource(
	ctx context.Context,
	name, namespace string,
	options *MockResourceOptions,
) *v1alpha1.Resource

func SanitizeNameForK8s

func SanitizeNameForK8s(name string) string

func SetupRepositoryWithSpecData

func SetupRepositoryWithSpecData(
	ctx context.Context,
	k8sClient client.Client,
	namespace, repositoryName string,
	specData []byte,
) *v1alpha1.Repository

func WaitForNotReadyObject

func WaitForNotReadyObject(ctx context.Context, k8sClient client.Client, obj util.Getter, expectedReason string)

func WaitForReadyObject

func WaitForReadyObject(ctx context.Context, k8sClient client.Client, obj util.Getter, waitForField map[string]any)

WaitForReadyObject waits for a Kubernetes object to reach a ready state.

Parameters: - ctx: The context for managing request deadlines and cancellations. - k8sClient: The Kubernetes client used to interact with the cluster. - obj: The Kubernetes object to monitor, implementing the util.Getter interface. - waitForField: A map specifying field-value pairs to validate on the object.

Behavior: - Periodically checks if the object exists, is not being deleted, and is in a ready state. - Verifies that the specified fields in waitForField match the expected values. - Fails the test if the object does not meet the conditions within 15 seconds.

Types

type MockComponentOptions

type MockComponentOptions struct {
	Client     client.Client
	Recorder   record.EventRecorder
	Info       v1alpha1.ComponentInfo
	Repository string
}

type MockResourceOptions

type MockResourceOptions struct {
	ComponentRef  corev1.LocalObjectReference
	ComponentInfo *v1alpha1.ComponentInfo
	ResourceInfo  *v1alpha1.ResourceInfo

	Clnt     client.Client
	Recorder record.EventRecorder
}

Jump to

Keyboard shortcuts

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