Documentation ¶
Index ¶
- func CRDs() string
- func CheckCRDFiles(crds []string) ([]string, error)
- func EqualConditionedStatus(x, y xpcorev1alpha1.ConditionedStatus) bool
- func EquateErrors() cmp.Option
- func Expand(path string) ([]string, error)
- func UseExistingCluster() bool
- type ConditionedStatusBuilder
- func (b *ConditionedStatusBuilder) Build() *xpcorev1alpha1.ConditionedStatus
- func (b *ConditionedStatusBuilder) WithFailedCondition(r, m string) *ConditionedStatusBuilder
- func (b *ConditionedStatusBuilder) WithReadyCondition() *ConditionedStatusBuilder
- func (b *ConditionedStatusBuilder) WithUnsetCondition(c xpcorev1alpha1.ConditionType) *ConditionedStatusBuilder
- type Env
- type MockClient
- func (c *MockClient) Create(ctx context.Context, obj runtime.Object) error
- func (c *MockClient) Delete(ctx context.Context, obj runtime.Object, opts ...client.DeleteOptionFunc) error
- func (c *MockClient) Get(ctx context.Context, key client.ObjectKey, obj runtime.Object) error
- func (c *MockClient) List(ctx context.Context, opts *client.ListOptions, list runtime.Object) error
- func (c *MockClient) Status() client.StatusWriter
- func (c *MockClient) Update(ctx context.Context, obj runtime.Object) error
- type MockCreateFn
- type MockDeleteFn
- type MockGetFn
- type MockListFn
- type MockStatusUpdateFn
- type MockStatusWriter
- type MockUpdateFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCRDFiles ¶
CheckCRDFiles - validates that all crds files are found.
func EqualConditionedStatus ¶
func EqualConditionedStatus(x, y xpcorev1alpha1.ConditionedStatus) bool
EqualConditionedStatus checks ConditionedStatus for equality ignoring the actual order of the conditions
func EquateErrors ¶
EquateErrors returns true if the supplied errors are of the same type and produce identical strings. This mirrors the error comparison behaviour of https://github.com/go-test/deep, which most Crossplane tests targeted before we switched to go-cmp.
func UseExistingCluster ¶
func UseExistingCluster() bool
UseExistingCluster - checks if USE_EXISTING_CLUSTER environment variable is set
Types ¶
type ConditionedStatusBuilder ¶
type ConditionedStatusBuilder struct {
*xpcorev1alpha1.ConditionedStatus
}
ConditionedStatusBuilder creates new ConditionedStatus
func NewConditionedStatusBuilder ¶
func NewConditionedStatusBuilder() *ConditionedStatusBuilder
NewConditionedStatusBuilder - new builder
func (*ConditionedStatusBuilder) Build ¶
func (b *ConditionedStatusBuilder) Build() *xpcorev1alpha1.ConditionedStatus
Build returns new ConditionedStatus
func (*ConditionedStatusBuilder) WithFailedCondition ¶
func (b *ConditionedStatusBuilder) WithFailedCondition(r, m string) *ConditionedStatusBuilder
WithFailedCondition sets and activates failed condition
func (*ConditionedStatusBuilder) WithReadyCondition ¶
func (b *ConditionedStatusBuilder) WithReadyCondition() *ConditionedStatusBuilder
WithReadyCondition sets and activates ready condition
func (*ConditionedStatusBuilder) WithUnsetCondition ¶
func (b *ConditionedStatusBuilder) WithUnsetCondition(c xpcorev1alpha1.ConditionType) *ConditionedStatusBuilder
WithUnsetCondition deactivates condition of given type
type Env ¶
type Env struct { envtest.Environment // contains filtered or unexported fields }
Env - wrapper for controller-runtime envtest with additional functionality
func NewEnv ¶
func NewEnv(namespace string, builder apiruntime.SchemeBuilder, crds ...string) *Env
NewEnv - create new test environment instance
func (*Env) Start ¶
Start - starts and bootstraps test environment ang returns Kubernetes config instance
func (*Env) StartClient ¶
StartClient - starts test environment and returns instance of go-client
func (*Env) Stop ¶
func (te *Env) Stop()
Stop - stops test environment performing additional cleanup (if needed)
func (*Env) StopAndExit ¶
StopAndExit - stops and exists, typically used as a last call in TestMain
type MockClient ¶
type MockClient struct { MockGet MockGetFn MockList MockListFn MockCreate MockCreateFn MockDelete MockDeleteFn MockUpdate MockUpdateFn MockStatusUpdate MockStatusUpdateFn }
MockClient implements controller-runtime's Client interface, allowing each method to be overridden for testing. The controller-runtime provides a fake client, but it is has surprising side effects (e.g. silently calling os.Exit(1)) and does not allow us control over the errors it returns.
func NewMockClient ¶
func NewMockClient() *MockClient
NewMockClient returns a MockClient that does nothing when its methods are called.
func (*MockClient) Delete ¶
func (c *MockClient) Delete(ctx context.Context, obj runtime.Object, opts ...client.DeleteOptionFunc) error
Delete calls MockClient's MockDelete function.
func (*MockClient) List ¶
func (c *MockClient) List(ctx context.Context, opts *client.ListOptions, list runtime.Object) error
List calls MockClient's MockList function.
func (*MockClient) Status ¶
func (c *MockClient) Status() client.StatusWriter
Status returns status writer for status sub-resource
type MockCreateFn ¶
A MockCreateFn is used to mock client.Client's Create implementation.
func NewMockCreateFn ¶
func NewMockCreateFn(err error) MockCreateFn
NewMockCreateFn returns a MockCreateFn that returns the supplied error.
type MockDeleteFn ¶
type MockDeleteFn func(ctx context.Context, obj runtime.Object, opts ...client.DeleteOptionFunc) error
A MockDeleteFn is used to mock client.Client's Delete implementation.
func NewMockDeleteFn ¶
func NewMockDeleteFn(err error) MockDeleteFn
NewMockDeleteFn returns a MockDeleteFn that returns the supplied error.
type MockGetFn ¶
A MockGetFn is used to mock client.Client's Get implementation.
func NewMockGetFn ¶
NewMockGetFn returns a MockGetFn that returns the supplied error.
type MockListFn ¶
A MockListFn is used to mock client.Client's List implementation.
func NewMockListFn ¶
func NewMockListFn(err error) MockListFn
NewMockListFn returns a MockListFn that returns the supplied error.
type MockStatusUpdateFn ¶
A MockStatusUpdateFn is used to mock client.Client's StatusUpdate implementation.
func NewMockStatusUpdateFn ¶
func NewMockStatusUpdateFn(err error) MockStatusUpdateFn
NewMockStatusUpdateFn returns a MockStatusUpdateFn that returns the supplied error.
type MockStatusWriter ¶
type MockStatusWriter struct {
MockUpdate MockStatusUpdateFn
}
MockStatusWriter provides mock functionality for status sub-resource
type MockUpdateFn ¶
A MockUpdateFn is used to mock client.Client's Update implementation.
func NewMockUpdateFn ¶
func NewMockUpdateFn(err error) MockUpdateFn
NewMockUpdateFn returns a MockUpdateFn that returns the supplied error.