import "sigs.k8s.io/cluster-api/test/helpers"
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 struct { manager.Manager client.Client Config *rest.Config // contains filtered or unexported fields }
TestEnvironment encapsulates a Kubernetes local test environment.
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 (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) CreateObj(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
CreateObj wraps around client.Create and creates the object.
func (t *TestEnvironment) StartManager(ctx context.Context) error
func (t *TestEnvironment) Stop() error
func (t *TestEnvironment) WaitForWebhooks()
Package helpers imports 38 packages (graph). Updated 2020-12-11. Refresh now. Tools for package owners.