Documentation ¶
Index ¶
- func CloneNameNamespace[T any, PT interface{ ... }](obj PT) PT
- func CreateObjs(ctx context.Context, t testing.TB, c client.Client, objs ...client.Object)
- func RunWithEnvironment(m *testing.M, opts ...EnvironmentOpt) int
- func UpdateStatusAndWait(ctx context.Context, t testing.TB, c client.Client, o client.Object)
- type APIExpecter
- func (a *APIExpecter) DeleteAllOfAndWait(ctx context.Context, obj client.Object)
- func (a *APIExpecter) DeleteAndWait(ctx context.Context, objs ...client.Object)
- func (a *APIExpecter) ShouldEventuallyExist(ctx context.Context, obj client.Object)
- func (a *APIExpecter) ShouldEventuallyMatch(ctx context.Context, obj client.Object, match func(g gomega.Gomega))
- func (a *APIExpecter) ShouldEventuallyNotExist(ctx context.Context, obj client.Object)
- type Environment
- type EnvironmentOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneNameNamespace ¶ added in v0.13.0
CloneNameNamespace returns an empty client object of the same type with the same and namespace. This is a helper to pass a new object to the "Eventually" methods while preserving the original object's data.
func CreateObjs ¶ added in v0.12.0
CreateObjs creates Objects using the provided kube client and waits until its cache has been updated with those objects.
func RunWithEnvironment ¶
func RunWithEnvironment(m *testing.M, opts ...EnvironmentOpt) int
RunWithEnvironment runs a suite of tests with an envtest that is shared across all tests We use testing.M as the input to avoid having this called directly from a test This ensures the envtest setup is always run from a TestMain.
Types ¶
type APIExpecter ¶ added in v0.13.0
type APIExpecter struct {
// contains filtered or unexported fields
}
APIExpecter is a helper to define eventual expectations over API resources in tests. It's useful when working with clients that maintain a cache, since changes might not be reflected immediately, causing tests to flake.
func NewAPIExpecter ¶ added in v0.13.0
func NewAPIExpecter(t testing.TB, client client.Client) *APIExpecter
NewAPIExpecter constructs a new APIExpecter.
func (*APIExpecter) DeleteAllOfAndWait ¶ added in v0.13.0
func (a *APIExpecter) DeleteAllOfAndWait(ctx context.Context, obj client.Object)
DeleteAllOfAndWait deletes all objects of the given type and waits until the client's cache reflects those changes.
func (*APIExpecter) DeleteAndWait ¶ added in v0.13.0
func (a *APIExpecter) DeleteAndWait(ctx context.Context, objs ...client.Object)
DeleteAndWait sends delete requests for a collection of objects and waits until the client cache reflects the changes.
func (*APIExpecter) ShouldEventuallyExist ¶ added in v0.13.0
func (a *APIExpecter) ShouldEventuallyExist(ctx context.Context, obj client.Object)
ShouldEventuallyExist defines an eventual expectation that succeeds if the provided object becomes readable by the client before the timeout expires.
func (*APIExpecter) ShouldEventuallyMatch ¶ added in v0.13.0
func (a *APIExpecter) ShouldEventuallyMatch(ctx context.Context, obj client.Object, match func(g gomega.Gomega))
ShouldEventuallyMatch defines an eventual expectation that succeeds if the provided object becomes readable by the client and matches the provider expectation before the timeout expires.
func (*APIExpecter) ShouldEventuallyNotExist ¶ added in v0.13.0
func (a *APIExpecter) ShouldEventuallyNotExist(ctx context.Context, obj client.Object)
ShouldEventuallyNotExist defines an eventual expectation that succeeds if the provided object becomes not found by the client before the timeout expires.
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func (*Environment) APIReader ¶
func (e *Environment) APIReader() client.Reader
APIReader returns a non cached reader client.
func (*Environment) Client ¶
func (e *Environment) Client() client.Client
func (*Environment) CreateNamespaceForTest ¶
func (*Environment) Manager ¶ added in v0.9.2
func (e *Environment) Manager() manager.Manager
Manager returns a Manager for the test environment.
type EnvironmentOpt ¶
type EnvironmentOpt func(ctx context.Context, e *Environment)
func WithAssignment ¶
func WithAssignment(envRef **Environment) EnvironmentOpt