helpers

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFakeClientWithScheme added in v0.3.7

func NewFakeClientWithScheme(clientScheme *runtime.Scheme, initObjs ...runtime.Object) client.Client

NewFakeClientWithScheme creates a new fake client with the given scheme for testing. You can choose to initialize it with a slice of runtime.Object; all the objects with be given a fake ResourceVersion="1" so it will be possible to use optimistic lock.

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 NewTestEnvironment

func NewTestEnvironment() *TestEnvironment

NewTestEnvironment 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 (*TestEnvironment) Cleanup added in v0.3.9

func (t *TestEnvironment) Cleanup(ctx context.Context, objs ...runtime.Object) error

func (*TestEnvironment) CreateKubeconfigSecret

func (t *TestEnvironment) CreateKubeconfigSecret(cluster *clusterv1.Cluster) error

func (*TestEnvironment) CreateNamespace added in v0.3.9

func (t *TestEnvironment) CreateNamespace(ctx context.Context, generateName string) (*corev1.Namespace, error)

func (*TestEnvironment) CreateObj added in v0.3.9

func (t *TestEnvironment) CreateObj(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error

CreateObj wraps around client.Create and creates the object.

func (*TestEnvironment) StartManager

func (t *TestEnvironment) StartManager() error

func (*TestEnvironment) Stop

func (t *TestEnvironment) Stop() error

func (*TestEnvironment) WaitForWebhooks added in v0.3.9

func (t *TestEnvironment) WaitForWebhooks()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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