Documentation ¶
Overview ¶
Package mock provides fake OAM resources for use in tests.
Index ¶
- Variables
- func GVK(o runtime.Object) schema.GroupVersionKind
- func SchemeWith(o ...runtime.Object) *runtime.Scheme
- type Conditioned
- type DiscoveryMapper
- func (m *DiscoveryMapper) GetMapper() (meta.RESTMapper, error)
- func (m *DiscoveryMapper) KindsFor(input schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
- func (m *DiscoveryMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)
- func (m *DiscoveryMapper) Refresh() (meta.RESTMapper, error)
- func (m *DiscoveryMapper) ResourcesFor(input schema.GroupVersionKind) (schema.GroupVersionResource, error)
- type GetMapper
- type KindsFor
- type LocalConnectionSecretWriterTo
- type LocalSecretReference
- type ManagedResourceReferencer
- type Manager
- type NotFoundErr
- type Object
- type RESTMapping
- type Refresh
- type ResourcesFor
- type Target
- type Trait
- type Workload
- type WorkloadReferencer
Constants ¶
This section is empty.
Variables ¶
var GV = schema.GroupVersion{Group: "g", Version: "v"}
GV returns a mock schema.GroupVersion.
Functions ¶
Types ¶
type Conditioned ¶
Conditioned is a mock that implements Conditioned interface.
func (*Conditioned) GetCondition ¶
func (m *Conditioned) GetCondition(ct condition.ConditionType) condition.Condition
GetCondition get the Condition with the given ConditionType.
func (*Conditioned) SetConditions ¶
func (m *Conditioned) SetConditions(c ...condition.Condition)
SetConditions sets the Conditions.
type DiscoveryMapper ¶
type DiscoveryMapper struct { MockGetMapper GetMapper MockRefresh Refresh MockRESTMapping RESTMapping MockKindsFor KindsFor MockResourcesFor ResourcesFor }
DiscoveryMapper for unit test only, use GetMapper and refresh will panic
func NewMockDiscoveryMapper ¶
func NewMockDiscoveryMapper() *DiscoveryMapper
NewMockDiscoveryMapper for unit test only
func (*DiscoveryMapper) GetMapper ¶
func (m *DiscoveryMapper) GetMapper() (meta.RESTMapper, error)
GetMapper for mock
func (*DiscoveryMapper) KindsFor ¶
func (m *DiscoveryMapper) KindsFor(input schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
KindsFor for mock
func (*DiscoveryMapper) RESTMapping ¶
func (m *DiscoveryMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)
RESTMapping for mock
func (*DiscoveryMapper) Refresh ¶
func (m *DiscoveryMapper) Refresh() (meta.RESTMapper, error)
Refresh for mock
func (*DiscoveryMapper) ResourcesFor ¶ added in v1.0.0
func (m *DiscoveryMapper) ResourcesFor(input schema.GroupVersionKind) (schema.GroupVersionResource, error)
ResourcesFor for mock
type GetMapper ¶
type GetMapper func() (meta.RESTMapper, error)
GetMapper is func type for mock convenience
type KindsFor ¶
type KindsFor func(input schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
KindsFor is func type for mock convenience
func NewMockKindsFor ¶
NewMockKindsFor for unit test only
type LocalConnectionSecretWriterTo ¶ added in v1.1.0
type LocalConnectionSecretWriterTo struct {
Ref *LocalSecretReference
}
LocalConnectionSecretWriterTo is a mock that implements LocalConnectionSecretWriterTo interface.
func (*LocalConnectionSecretWriterTo) GetWriteConnectionSecretToReference ¶ added in v1.1.0
func (m *LocalConnectionSecretWriterTo) GetWriteConnectionSecretToReference() *LocalSecretReference
GetWriteConnectionSecretToReference gets the WriteConnectionSecretToReference.
func (*LocalConnectionSecretWriterTo) SetWriteConnectionSecretToReference ¶ added in v1.1.0
func (m *LocalConnectionSecretWriterTo) SetWriteConnectionSecretToReference(r *LocalSecretReference)
SetWriteConnectionSecretToReference sets the WriteConnectionSecretToReference.
type LocalSecretReference ¶ added in v1.1.0
type LocalSecretReference struct { // Name of the secret. Name string `json:"name"` }
A LocalSecretReference is a reference to a secret in the same namespace as the referencer.
type ManagedResourceReferencer ¶
type ManagedResourceReferencer struct{ Ref *corev1.ObjectReference }
ManagedResourceReferencer is a mock that implements ManagedResourceReferencer interface.
func (*ManagedResourceReferencer) GetResourceReference ¶
func (m *ManagedResourceReferencer) GetResourceReference() *corev1.ObjectReference
GetResourceReference gets the ResourceReference.
func (*ManagedResourceReferencer) SetResourceReference ¶
func (m *ManagedResourceReferencer) SetResourceReference(r *corev1.ObjectReference)
SetResourceReference sets the ResourceReference.
type Manager ¶
Manager is a mock object that satisfies manager.Manager interface.
type NotFoundErr ¶ added in v1.0.0
NotFoundErr describes NotFound Resource error
func NewMockNotFoundErr ¶ added in v1.0.0
func NewMockNotFoundErr() NotFoundErr
NewMockNotFoundErr return a mock NotFoundErr
func (NotFoundErr) Error ¶ added in v1.0.0
func (mock NotFoundErr) Error() string
Error return error info
func (NotFoundErr) Status ¶ added in v1.0.0
func (mock NotFoundErr) Status() metav1.Status
Status returns the Status Reason
type Object ¶
type Object struct { metav1.ObjectMeta runtime.Object }
Object is a mock that implements Object interface.
func (*Object) DeepCopyObject ¶
DeepCopyObject returns a copy of the object as runtime.Object
func (*Object) GetObjectKind ¶
func (o *Object) GetObjectKind() schema.ObjectKind
GetObjectKind returns schema.ObjectKind.
type RESTMapping ¶
RESTMapping is func type for mock convenience
func NewMockRESTMapping ¶
func NewMockRESTMapping(resource string) RESTMapping
NewMockRESTMapping for unit test only
type Refresh ¶
type Refresh func() (meta.RESTMapper, error)
Refresh is func type for mock convenience
type ResourcesFor ¶ added in v1.0.0
type ResourcesFor func(input schema.GroupVersionKind) (schema.GroupVersionResource, error)
ResourcesFor is func type for mock convenience
type Target ¶ added in v1.1.0
type Target struct { metav1.ObjectMeta ManagedResourceReferencer LocalConnectionSecretWriterTo condition.ConditionedStatus }
Target is a mock that implements Target interface.
func (*Target) DeepCopyObject ¶ added in v1.1.0
DeepCopyObject returns a deep copy of Target as runtime.Object.
func (*Target) GetObjectKind ¶ added in v1.1.0
func (m *Target) GetObjectKind() schema.ObjectKind
GetObjectKind returns schema.ObjectKind.
type Trait ¶
type Trait struct { metav1.ObjectMeta runtime.Object condition.ConditionedStatus WorkloadReferencer }
Trait is a mock that implements Trait interface.
func (*Trait) DeepCopyObject ¶
DeepCopyObject returns a copy of the object as runtime.Object
func (*Trait) GetObjectKind ¶
func (t *Trait) GetObjectKind() schema.ObjectKind
GetObjectKind returns schema.ObjectKind.
type Workload ¶
type Workload struct { metav1.ObjectMeta runtime.Object condition.ConditionedStatus }
Workload is a mock that implements Workload interface.
func (*Workload) DeepCopyObject ¶
DeepCopyObject returns a copy of the object as runtime.Object
func (*Workload) GetObjectKind ¶
func (w *Workload) GetObjectKind() schema.ObjectKind
GetObjectKind returns schema.ObjectKind.
type WorkloadReferencer ¶
type WorkloadReferencer struct{ Ref corev1.ObjectReference }
A WorkloadReferencer references an OAM Workload type.
func (*WorkloadReferencer) GetWorkloadReference ¶
func (w *WorkloadReferencer) GetWorkloadReference() corev1.ObjectReference
GetWorkloadReference gets the WorkloadReference.
func (*WorkloadReferencer) SetWorkloadReference ¶
func (w *WorkloadReferencer) SetWorkloadReference(r corev1.ObjectReference)
SetWorkloadReference sets the WorkloadReference.