Documentation ¶
Index ¶
- func NewFakeClientWithScheme(clientScheme *runtime.Scheme, initObjs ...runtime.Object) client.Client
- type TestEnvironment
- func (t *TestEnvironment) Cleanup(ctx context.Context, objs ...runtime.Object) error
- func (t *TestEnvironment) CreateKubeconfigSecret(cluster *clusterv1.Cluster) error
- func (t *TestEnvironment) CreateNamespace(ctx context.Context, generateName string) (*corev1.Namespace, error)
- func (t *TestEnvironment) CreateObj(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error
- func (t *TestEnvironment) StartManager() error
- func (t *TestEnvironment) Stop() error
- func (t *TestEnvironment) WaitForWebhooks()
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) CreateKubeconfigSecret ¶
func (t *TestEnvironment) CreateKubeconfigSecret(cluster *clusterv1.Cluster) error
func (*TestEnvironment) CreateNamespace ¶ added in v0.3.9
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()
Click to show internal directories.
Click to hide internal directories.