mock

package
v1.9.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package mock provides fake OAM resources for use in tests.

Index

Constants

This section is empty.

Variables

View Source
var GV = schema.GroupVersion{Group: "g", Version: "v"}

GV returns a mock schema.GroupVersion.

Functions

func GVK

GVK returns the mock GVK of the given object.

func NewClient added in v1.9.0

NewClient new client with given mappings

func SchemeWith

func SchemeWith(o ...runtime.Object) *runtime.Scheme

SchemeWith returns a scheme with list of `runtime.Object`s registered.

Types

type Client added in v1.9.0

type Client struct {
	client.Client
	// contains filtered or unexported fields
}

Client fake client

func (*Client) RESTMapper added in v1.9.0

func (in *Client) RESTMapper() meta.RESTMapper

RESTMapper override default mapper

type Conditioned

type Conditioned struct{ Conditions []condition.Condition }

Conditioned is a mock that implements Conditioned interface.

func (*Conditioned) GetCondition

GetCondition get the Condition with the given ConditionType.

func (*Conditioned) SetConditions

func (m *Conditioned) SetConditions(c ...condition.Condition)

SetConditions sets the Conditions.

type LocalConnectionSecretWriterTo added in v1.1.0

type LocalConnectionSecretWriterTo struct {
	Ref *LocalSecretReference `json:"local_secret_ref"`
}

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 `json:"ref"`
}

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

type Manager struct {
	manager.Manager

	Client client.Client
	Scheme *runtime.Scheme
}

Manager is a mock object that satisfies manager.Manager interface.

func (*Manager) GetClient

func (m *Manager) GetClient() client.Client

GetClient returns the client.

func (*Manager) GetConfig

func (m *Manager) GetConfig() *rest.Config

GetConfig returns the config for test.

func (*Manager) GetScheme

func (m *Manager) GetScheme() *runtime.Scheme

GetScheme returns the scheme.

type NotFoundErr added in v1.0.0

type NotFoundErr struct {
	NotFoundStatus metav1.Status
}

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

func (o *Object) DeepCopyObject() runtime.Object

DeepCopyObject returns a copy of the object as runtime.Object

func (*Object) GetObjectKind

func (o *Object) GetObjectKind() schema.ObjectKind

GetObjectKind returns schema.ObjectKind.

type RESTMapper added in v1.9.0

type RESTMapper struct {
	meta.RESTMapper
	// contains filtered or unexported fields
}

RESTMapper test mapper

func (*RESTMapper) KindsFor added in v1.9.0

func (in *RESTMapper) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error)

KindsFor get kinds

func (*RESTMapper) RESTMapping added in v1.9.0

func (in *RESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)

RESTMapping get mapping

type Target added in v1.1.0

Target is a mock that implements Target interface.

func (*Target) DeepCopyObject added in v1.1.0

func (m *Target) DeepCopyObject() runtime.Object

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

Trait is a mock that implements Trait interface.

func (*Trait) DeepCopyObject

func (t *Trait) DeepCopyObject() runtime.Object

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

Workload is a mock that implements Workload interface.

func (*Workload) DeepCopyObject

func (w *Workload) DeepCopyObject() runtime.Object

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 `json:"ref"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL