Documentation
¶
Index ¶
- Variables
- func AssertErrorCondition[T any](t *testing.T, o client.Object, getConditions func(T) []metav1.Condition, ...)
- func AssertHasPhase(t *testing.T, o object.MultiPhaseObject, phase string)
- func AssertIsOnError(t *testing.T, o object.RemoteObject, expected bool)
- func AssertIsSync(t *testing.T, o object.RemoteObject)
- func AssertManagedByOperator(t *testing.T, obj client.Object)
- func AssertOwnerReference(t *testing.T, obj client.Object, owner metav1.Object)
- func AssertReadyCondition[T any](t *testing.T, o client.Object, getConditions func(T) []metav1.Condition)
- func EqualFromYamlFile[k8sobject any](t *testing.T, expectedYamlFile string, actual client.Object, ...)
- func RunWithTimeout(f func() error, timeout time.Duration, interval time.Duration) (isTimeout bool, err error)
- func WaitForGenerationIncrement[T client.Object](t *testing.T, c client.Client, key types.NamespacedName, minGeneration int64, ...)
- func WaitForReadyCondition[T client.Object](t *testing.T, c client.Client, key types.NamespacedName, timeout time.Duration)
- func WaitForResourceVersionChange[T client.Object](t *testing.T, c client.Client, key types.NamespacedName, oldVersion string, ...)
- type CRBuilder
- type ControllerSetupFunc
- type EnvTestSuite
- type EnvTestSuiteConfig
- type InterceptorClient
- func (c *InterceptorClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (c *InterceptorClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (c *InterceptorClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (c *InterceptorClient) Get(ctx context.Context, key types.NamespacedName, obj client.Object, ...) error
- func (c *InterceptorClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)
- func (c *InterceptorClient) IsObjectNamespaced(obj runtime.Object) (bool, error)
- func (c *InterceptorClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
- func (c *InterceptorClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (c *InterceptorClient) RESTMapper() meta.RESTMapper
- func (c *InterceptorClient) Scheme() *runtime.Scheme
- func (c *InterceptorClient) Status() client.SubResourceWriter
- func (c *InterceptorClient) SubResource(subResource string) client.SubResourceClient
- func (c *InterceptorClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- type InterceptorStatusClient
- func (s *InterceptorStatusClient) Create(ctx context.Context, obj client.Object, subResource client.Object, ...) error
- func (s *InterceptorStatusClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (s *InterceptorStatusClient) Update(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error
- type SchemeRegistration
- type TestCase
- type TestStep
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEventuallyTimeout = errors.New("timed out waiting for condition")
Functions ¶
func AssertErrorCondition ¶
func AssertHasPhase ¶
func AssertHasPhase(t *testing.T, o object.MultiPhaseObject, phase string)
func AssertIsOnError ¶
func AssertIsOnError(t *testing.T, o object.RemoteObject, expected bool)
func AssertIsSync ¶
func AssertIsSync(t *testing.T, o object.RemoteObject)
func AssertOwnerReference ¶
func AssertReadyCondition ¶
func EqualFromYamlFile ¶
func RunWithTimeout ¶
func WaitForReadyCondition ¶
Types ¶
type CRBuilder ¶
func (*CRBuilder[T]) WithAnnotations ¶
func (*CRBuilder[T]) WithLabels ¶
func (*CRBuilder[T]) WithTypeMeta ¶
func (b *CRBuilder[T]) WithTypeMeta(gvk schema.GroupVersionKind) *CRBuilder[T]
type ControllerSetupFunc ¶
type EnvTestSuite ¶
type EnvTestSuite struct {
suite.Suite
K8sClient client.Client
Cfg *rest.Config
Manager ctrl.Manager
Config EnvTestSuiteConfig
// contains filtered or unexported fields
}
func (*EnvTestSuite) SetupSuite ¶
func (s *EnvTestSuite) SetupSuite()
func (*EnvTestSuite) TearDownSuite ¶
func (s *EnvTestSuite) TearDownSuite()
type EnvTestSuiteConfig ¶
type EnvTestSuiteConfig struct {
CRDDirectoryPaths []string
SchemeRegistrations []SchemeRegistration
ControllerSetupFuncs []ControllerSetupFunc
MetricsBindAddress string
ErrorIfCRDPathMissing bool
}
type InterceptorClient ¶
type InterceptorClient struct {
client.Client
GetInterceptor func(ctx context.Context, key types.NamespacedName, obj client.Object, opts ...client.GetOption) error
ListInterceptor func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
CreateInterceptor func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
DeleteInterceptor func(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
UpdateInterceptor func(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
PatchInterceptor func(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
DeleteAllOfInterceptor func(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
StatusUpdateInterceptor func(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error
StatusPatchInterceptor func(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.SubResourcePatchOption) error
StatusCreateInterceptor func(ctx context.Context, obj client.Object, subResource client.Object, opts ...client.SubResourceCreateOption) error
}
func NewInterceptorClient ¶
func NewInterceptorClient(c client.Client) *InterceptorClient
func (*InterceptorClient) Create ¶
func (c *InterceptorClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
func (*InterceptorClient) Delete ¶
func (c *InterceptorClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
func (*InterceptorClient) DeleteAllOf ¶
func (c *InterceptorClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
func (*InterceptorClient) Get ¶
func (c *InterceptorClient) Get(ctx context.Context, key types.NamespacedName, obj client.Object, opts ...client.GetOption) error
func (*InterceptorClient) GroupVersionKindFor ¶
func (c *InterceptorClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)
func (*InterceptorClient) IsObjectNamespaced ¶
func (c *InterceptorClient) IsObjectNamespaced(obj runtime.Object) (bool, error)
func (*InterceptorClient) List ¶
func (c *InterceptorClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
func (*InterceptorClient) Patch ¶
func (c *InterceptorClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
func (*InterceptorClient) RESTMapper ¶
func (c *InterceptorClient) RESTMapper() meta.RESTMapper
func (*InterceptorClient) Scheme ¶
func (c *InterceptorClient) Scheme() *runtime.Scheme
func (*InterceptorClient) Status ¶
func (c *InterceptorClient) Status() client.SubResourceWriter
func (*InterceptorClient) SubResource ¶
func (c *InterceptorClient) SubResource(subResource string) client.SubResourceClient
func (*InterceptorClient) Update ¶
func (c *InterceptorClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
type InterceptorStatusClient ¶
type InterceptorStatusClient struct {
// contains filtered or unexported fields
}
func (*InterceptorStatusClient) Create ¶
func (s *InterceptorStatusClient) Create(ctx context.Context, obj client.Object, subResource client.Object, opts ...client.SubResourceCreateOption) error
func (*InterceptorStatusClient) Patch ¶
func (s *InterceptorStatusClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.SubResourcePatchOption) error
func (*InterceptorStatusClient) Update ¶
func (s *InterceptorStatusClient) Update(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error
type SchemeRegistration ¶
type TestCase ¶
type TestCase[k8sObject client.Object] struct { // Permit to lauch some preaction, like init mock PreTest func(stepName *string, data map[string]any) error Steps []TestStep[k8sObject] // contains filtered or unexported fields }
func NewTestCase ¶
func (*TestCase[k8sObject]) Eventually ¶
type TestStep ¶
type TestStep[k8sObject client.Object] struct { Name string Pre func(c client.Client, data map[string]any) error Do func(c client.Client, key types.NamespacedName, o k8sObject, data map[string]any) error Check func(t *testing.T, c client.Client, key types.NamespacedName, o k8sObject, data map[string]any) error }
func NewCreateStep ¶
func NewDeleteStep ¶
Click to show internal directories.
Click to hide internal directories.