envtest

package
v2.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(ctx context.Context, t *testing.T, client ctrlclient.Client) corev1.Namespace

CreateNamespace creates namespace using the provided client and returns it.

func CreatePod

func CreatePod(ctx context.Context, t *testing.T, client ctrlclient.Client, ns string) corev1.Pod

CreatePod creates pod using the provided client and returns it.

func Setup

func Setup(t *testing.T, scheme *runtime.Scheme) *rest.Config

Setup sets up the envtest environment which will be stopped on test cleanup using t.Cleanup().

Note: If you want apiserver output on stdout set KUBEBUILDER_ATTACH_CONTROL_PLANE_OUTPUT to true when running tests.

func StartReconciler

func StartReconciler(ctx context.Context, t *testing.T, scheme *runtime.Scheme, cfg *rest.Config, reconciler controllers.Reconciler, opts *v1alpha1.ControllerManagerConfiguration)

StartReconciler creates a controller manager and starts the provided reconciler as its runnable. It also adds a t.Cleanup which waits for the maanger to exit so that the test can be self contained and logs from different tests' managers don't mix up.

Types

This section is empty.

Jump to

Keyboard shortcuts

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