Documentation ¶
Overview ¶
Package helpers contains helpers for creating a test environment.
Index ¶
- func InitializeWebhookInEnvironment(e *envtest.Environment, configPath string)
- type Mod
- type TestEnvironment
- func (t *TestEnvironment) Cleanup(ctx context.Context, objs ...client.Object) error
- func (t *TestEnvironment) CleanupAndWait(ctx context.Context, objs ...client.Object) error
- func (t *TestEnvironment) CreateKubeconfigSecret(ctx context.Context, cluster *clusterv1.Cluster) error
- func (t *TestEnvironment) CreateNamespace(ctx context.Context, generateName string) (*corev1.Namespace, error)
- func (t *TestEnvironment) StartManager(ctx context.Context) error
- func (t *TestEnvironment) Stop() error
- func (t *TestEnvironment) WaitForWebhooks()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeWebhookInEnvironment ¶ added in v1.11.0
func InitializeWebhookInEnvironment(e *envtest.Environment, configPath string)
InitializeWebhookInEnvironment initializes WebhookInstallOptions for the provided environment.
Types ¶
type TestEnvironment ¶
type TestEnvironment struct { manager.Manager client.Client Config *rest.Config Simulator *vcsim.Simulator // contains filtered or unexported fields }
TestEnvironment encapsulates a Kubernetes local test environment.
func NewTestEnvironment ¶
func NewTestEnvironment(ctx context.Context) *TestEnvironment
NewTestEnvironment creates a new environment spinning up a local api-server.
func (*TestEnvironment) CleanupAndWait ¶ added in v1.11.0
CleanupAndWait removes objects from the TestEnvironment and waits for them to be gone.
func (*TestEnvironment) CreateKubeconfigSecret ¶
func (t *TestEnvironment) CreateKubeconfigSecret(ctx context.Context, cluster *clusterv1.Cluster) error
CreateKubeconfigSecret creates a secret with the KubeConfig to access a cluster in the TestEnvironment.
func (*TestEnvironment) CreateNamespace ¶
func (t *TestEnvironment) CreateNamespace(ctx context.Context, generateName string) (*corev1.Namespace, error)
CreateNamespace creates a new namespace in the TestEnvironment.
func (*TestEnvironment) StartManager ¶
func (t *TestEnvironment) StartManager(ctx context.Context) error
StartManager starts the TestEnvironment's controller runtime manager.
func (*TestEnvironment) Stop ¶
func (t *TestEnvironment) Stop() error
Stop stops the TestEnvironment's controller runtime manager.
func (*TestEnvironment) WaitForWebhooks ¶
func (t *TestEnvironment) WaitForWebhooks()
WaitForWebhooks waits for TestEnvironment's webhooks to accept connections.