Documentation ¶
Index ¶
- func GetMockedContext(ctx context.Context, data []MockData) context.Context
- func GetMockedResourceAndErrorFromContext[T any](ctx context.Context, contextKey ContextKey, _ T) (T, error)
- func GetObject(name, namespace string, cli client.Client, ctx context.Context, ...) error
- type ContextKey
- type MockData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMockedContext ¶
GetMockedContext creates a new context with the given MockData items.
func GetMockedResourceAndErrorFromContext ¶
func GetMockedResourceAndErrorFromContext[T any](ctx context.Context, contextKey ContextKey, _ T) (T, error)
GetMockedResourceAndErrorFromContext returns the mocked data found in the context passed as an argument. The data is to be found in the contextDataKey key. If not there, a panic will be raised.
Types ¶
type ContextKey ¶
type ContextKey int
ContextKey is a kye that will be used within a context to reference a MockData item.
type MockData ¶
type MockData struct { ContextKey ContextKey Err error Resource any }
MockData represents the mocked data that will be returned by a mocked loader method.
Click to show internal directories.
Click to hide internal directories.