Documentation ¶
Index ¶
- Variables
- func Identify(name, namespace string, gvk schema.GroupVersionKind, subPath string) resourceIdentifier
- func New(mockCfg *config.MockConfiguration, testMode bool) (persist.Persister, error)
- type ErrUnexpectedCall
- type ErrUnexpectedReturn
- type MockPersister
- func (p *MockPersister) ClearExpectedCalls() []*MockedCall
- func (p *MockPersister) Delete(ctx context.Context, name, namespace string, gvk schema.GroupVersionKind, ...) error
- func (p *MockPersister) Exists(ctx context.Context, name, namespace string, gvk schema.GroupVersionKind, ...) (bool, error)
- func (p *MockPersister) ExpectCall(expected *MockedCall, expectedReturn *MockedReturn)
- func (p *MockPersister) Get(ctx context.Context, name, namespace string, gvk schema.GroupVersionKind, ...) (*unstructured.Unstructured, error)
- func (p *MockPersister) InjectLogger(il *logging.Logger)
- func (p *MockPersister) InternalPersister() persist.Persister
- func (p *MockPersister) IsExpectingCalls() bool
- func (p *MockPersister) Persist(ctx context.Context, resource *unstructured.Unstructured, ...) (*unstructured.Unstructured, bool, error)
- type MockedCall
- func MockedDeleteCall(name, namespace string, gvk schema.GroupVersionKind, subPath string) *MockedCall
- func MockedExistsCall(name, namespace string, gvk schema.GroupVersionKind, subPath string) *MockedCall
- func MockedGetCall(name, namespace string, gvk schema.GroupVersionKind, subPath string) *MockedCall
- func MockedPersistCall(resource *unstructured.Unstructured, t persist.Transformer, subPath string) *MockedCall
- type MockedReturn
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotInTestMode = errors.New("mock persister is not in test mode")
Functions ¶
Types ¶
type ErrUnexpectedCall ¶
type ErrUnexpectedCall struct {
// contains filtered or unexported fields
}
func (*ErrUnexpectedCall) Error ¶
func (e *ErrUnexpectedCall) Error() string
type ErrUnexpectedReturn ¶
type ErrUnexpectedReturn struct {
// contains filtered or unexported fields
}
func (*ErrUnexpectedReturn) Error ¶
func (e *ErrUnexpectedReturn) Error() string
type MockPersister ¶
type MockPersister struct { Storage map[resourceIdentifier]*unstructured.Unstructured // contains filtered or unexported fields }
MockPersister stores resources in memory and logs operations on it. It does not actually persist anything.
func (*MockPersister) ClearExpectedCalls ¶
func (p *MockPersister) ClearExpectedCalls() []*MockedCall
func (*MockPersister) Delete ¶
func (p *MockPersister) Delete(ctx context.Context, name, namespace string, gvk schema.GroupVersionKind, subPath string) error
func (*MockPersister) Exists ¶
func (p *MockPersister) Exists(ctx context.Context, name, namespace string, gvk schema.GroupVersionKind, subPath string) (bool, error)
func (*MockPersister) ExpectCall ¶
func (p *MockPersister) ExpectCall(expected *MockedCall, expectedReturn *MockedReturn)
func (*MockPersister) Get ¶
func (p *MockPersister) Get(ctx context.Context, name, namespace string, gvk schema.GroupVersionKind, subPath string) (*unstructured.Unstructured, error)
func (*MockPersister) InjectLogger ¶
func (p *MockPersister) InjectLogger(il *logging.Logger)
func (*MockPersister) InternalPersister ¶
func (p *MockPersister) InternalPersister() persist.Persister
func (*MockPersister) IsExpectingCalls ¶
func (p *MockPersister) IsExpectingCalls() bool
func (*MockPersister) Persist ¶
func (p *MockPersister) Persist(ctx context.Context, resource *unstructured.Unstructured, t persist.Transformer, subPath string) (*unstructured.Unstructured, bool, error)
type MockedCall ¶
type MockedCall struct {
// contains filtered or unexported fields
}
func MockedDeleteCall ¶
func MockedDeleteCall(name, namespace string, gvk schema.GroupVersionKind, subPath string) *MockedCall
func MockedExistsCall ¶
func MockedExistsCall(name, namespace string, gvk schema.GroupVersionKind, subPath string) *MockedCall
func MockedGetCall ¶
func MockedGetCall(name, namespace string, gvk schema.GroupVersionKind, subPath string) *MockedCall
func MockedPersistCall ¶
func MockedPersistCall(resource *unstructured.Unstructured, t persist.Transformer, subPath string) *MockedCall
type MockedReturn ¶
type MockedReturn struct {
// contains filtered or unexported fields
}
func MockedDeleteReturn ¶
func MockedDeleteReturn(err error) *MockedReturn
func MockedExistsReturn ¶
func MockedExistsReturn(exists bool, err error) *MockedReturn
func MockedGetReturn ¶
func MockedGetReturn(resource *unstructured.Unstructured, err error) *MockedReturn
func MockedPersistReturn ¶
func MockedPersistReturn(resource *unstructured.Unstructured, changed bool, err error) *MockedReturn
Click to show internal directories.
Click to hide internal directories.