cluster-api: sigs.k8s.io/cluster-api/test/helpers Index | Files | Directories

package helpers

import "sigs.k8s.io/cluster-api/test/helpers"

Index

Package Files

client.go envtest.go

func NewFakeClientWithScheme Uses

func NewFakeClientWithScheme(clientScheme *runtime.Scheme, initObjs ...client.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.

type TestEnvironment Uses

type TestEnvironment struct {
    manager.Manager
    client.Client
    Config *rest.Config
    // contains filtered or unexported fields
}

TestEnvironment encapsulates a Kubernetes local test environment.

func NewTestEnvironment Uses

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 Uses

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

func (*TestEnvironment) CreateKubeconfigSecret Uses

func (t *TestEnvironment) CreateKubeconfigSecret(ctx context.Context, cluster *clusterv1.Cluster) error

func (*TestEnvironment) CreateNamespace Uses

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

func (*TestEnvironment) CreateObj Uses

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

CreateObj wraps around client.Create and creates the object.

func (*TestEnvironment) StartManager Uses

func (t *TestEnvironment) StartManager(ctx context.Context) error

func (*TestEnvironment) Stop Uses

func (t *TestEnvironment) Stop() error

func (*TestEnvironment) WaitForWebhooks Uses

func (t *TestEnvironment) WaitForWebhooks()

Directories

PathSynopsis
scheme

Package helpers imports 39 packages (graph). Updated 2020-10-23. Refresh now. Tools for package owners.