Documentation ¶
Overview ¶
Package helpers provides a set of utilities for testing controllers.
Index ¶
- func PartialMatchCreateTargetGroupInput(t *testing.T, i *elbv2.CreateTargetGroupInput) gomock.Matcher
- type TestEnvironment
- func (t *TestEnvironment) Cleanup(ctx context.Context, objs ...client.Object) 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()
- type TestEnvironmentConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PartialMatchCreateTargetGroupInput ¶ added in v2.5.1
func PartialMatchCreateTargetGroupInput(t *testing.T, i *elbv2.CreateTargetGroupInput) gomock.Matcher
PartialMatchCreateTargetGroupInput matches a partial CreateTargetGroupInput struct based on fuzzy matching rules.
Types ¶
type TestEnvironment ¶
type TestEnvironment struct { manager.Manager client.Client Config *rest.Config // contains filtered or unexported fields }
TestEnvironment encapsulates a Kubernetes local test environment.
func (*TestEnvironment) CreateNamespace ¶
func (t *TestEnvironment) CreateNamespace(ctx context.Context, generateName string) (*corev1.Namespace, error)
CreateNamespace creates a new namespace with a generated name.
func (*TestEnvironment) StartManager ¶
func (t *TestEnvironment) StartManager(ctx context.Context) error
StartManager starts the test controller against the local API server.
func (*TestEnvironment) Stop ¶
func (t *TestEnvironment) Stop() error
Stop stops the test environment.
func (*TestEnvironment) WaitForWebhooks ¶
func (t *TestEnvironment) WaitForWebhooks()
WaitForWebhooks will not return until the webhook port is open.
type TestEnvironmentConfiguration ¶
type TestEnvironmentConfiguration struct {
// contains filtered or unexported fields
}
TestEnvironmentConfiguration encapsulates the interim, mutable configuration of the Kubernetes local test environment.
func NewTestEnvironmentConfiguration ¶
func NewTestEnvironmentConfiguration(crdDirectoryPaths []string) *TestEnvironmentConfiguration
NewTestEnvironmentConfiguration creates a new test environment configuration for running tests.
func (*TestEnvironmentConfiguration) Build ¶
func (t *TestEnvironmentConfiguration) Build() (*TestEnvironment, error)
Build creates a new environment spinning up a local api-server. This function should be called only once for each package you're running tests within, usually the environment is initialized in a suite_test.go file within a `BeforeSuite` ginkgo block.
func (*TestEnvironmentConfiguration) WithWebhookConfiguration ¶
func (t *TestEnvironmentConfiguration) WithWebhookConfiguration(tag string, relativeFilePath string) *TestEnvironmentConfiguration
WithWebhookConfiguration adds the CRD webhook configuration given a named tag and file path for the webhook manifest.
Directories ¶
Path | Synopsis |
---|---|
Package external provides mock CRDs for use in tests.
|
Package external provides mock CRDs for use in tests. |
Package kubernetesversions implements kubernetes version functions.
|
Package kubernetesversions implements kubernetes version functions. |