fake

package
v1.13.1-rc.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDecoder

func NewDecoder(us []*unstructured.Unstructured) decode.Decoder

NewDecoder returns a new decoder.

func NewDiscoveryClient

func NewDiscoveryClient(gvks ...schema.GroupVersionKind) discovery.ServerResourcer

NewDiscoveryClient returns a discoveryClient that reports types available to the API Server.

Does not report the scope of each GVK as no tests requiring a discoveryClient use scope information.

func NewErrorClient

func NewErrorClient(err error) client.Client

NewErrorClient returns a Client that always returns an error.

Types

type Client

type Client struct {
	Objects map[core.ID]client.Object
	// contains filtered or unexported fields
}

Client is a fake implementation of client.Client.

func NewClient

func NewClient(t *testing.T, scheme *runtime.Scheme, objs ...client.Object) *Client

NewClient instantiates a new fake.Client pre-populated with the specified objects.

Calls t.Fatal if unable to properly instantiate Client.

func (*Client) Applier

func (c *Client) Applier() reconcile.Applier

Applier returns a fake.Applier wrapping this fake.Client. Callers using the resulting Applier will read from/write to the original fake.Client.

func (*Client) Check

func (c *Client) Check(t *testing.T, wants ...client.Object)

Check reports an error to `t` if the passed objects in wants do not match the expected set of objects in the fake.Client, and only the passed updates to Status fields were recorded.

func (*Client) Create

func (c *Client) Create(_ context.Context, obj client.Object, opts ...client.CreateOption) error

Create implements client.Client.

func (*Client) Delete

func (c *Client) Delete(_ context.Context, obj client.Object, opts ...client.DeleteOption) error

Delete implements client.Client.

func (*Client) DeleteAllOf

func (c *Client) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error

DeleteAllOf implements client.Client.

func (*Client) Get

func (c *Client) Get(_ context.Context, key client.ObjectKey, obj client.Object) error

Get implements client.Client.

func (*Client) List

func (c *Client) List(_ context.Context, list client.ObjectList, opts ...client.ListOption) error

List implements client.Client.

Does not paginate results.

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, obj client.Object, _ client.Patch, opts ...client.PatchOption) error

Patch implements client.Client.

func (*Client) RESTMapper

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

RESTMapper implements client.Client.

func (*Client) Scheme

func (c *Client) Scheme() *runtime.Scheme

Scheme implements client.Client.

func (*Client) Status

func (c *Client) Status() client.StatusWriter

Status implements client.Client.

func (*Client) Update

func (c *Client) Update(_ context.Context, obj client.Object, opts ...client.UpdateOption) error

Update implements client.Client. It does not update the status field.

type ErrorClient

type ErrorClient struct {
	// contains filtered or unexported fields
}

ErrorClient is a Client that always returns a specified error.

func (ErrorClient) Create

Create implements client.Client.

func (ErrorClient) Delete

Delete implements client.Client.

func (ErrorClient) DeleteAllOf

DeleteAllOf implements client.Client.

func (ErrorClient) Get

Get implements client.Client.

func (ErrorClient) List

List implements client.Client.

func (ErrorClient) Patch

Patch implements client.Client.

func (ErrorClient) RESTMapper

func (e ErrorClient) RESTMapper() meta.RESTMapper

RESTMapper implements client.Client.

func (ErrorClient) Scheme

func (e ErrorClient) Scheme() *runtime.Scheme

Scheme implements client.Client.

func (ErrorClient) Status

func (e ErrorClient) Status() client.StatusWriter

Status implements client.Client.

func (ErrorClient) Update

Update implements client.Client.

type Event

type Event struct {
	schema.GroupVersionKind
	client.ObjectKey
	EventType, Reason string
}

Event represents a K8S Event that was emitted as result of the reconcile.

func NewEvent

func NewEvent(o client.Object, eventtype, reason string) *Event

NewEvent instantiates a new Event.

type EventRecorder

type EventRecorder struct {
	// contains filtered or unexported fields
}

EventRecorder tracks the set of events emitted as part of a Kubernetes reconcile.

func NewEventRecorder

func NewEventRecorder(t *testing.T) *EventRecorder

NewEventRecorder initializes a new fake.EventRecorder.

func (*EventRecorder) AnnotatedEventf

func (e *EventRecorder) AnnotatedEventf(object runtime.Object, _ map[string]string, eventtype, reason, _ string, _ ...interface{})

AnnotatedEventf implements record.EventRecorder.

func (*EventRecorder) Check

func (e *EventRecorder) Check(t *testing.T, wantEvents ...Event)

Check ensures the EventRecorder got the correct set of updates to Syncs.

func (*EventRecorder) Event

func (e *EventRecorder) Event(object runtime.Object, eventtype, reason, _ string)

Event implements record.EventRecorder.

func (*EventRecorder) Eventf

func (e *EventRecorder) Eventf(object runtime.Object, eventtype, reason, _ string, _ ...interface{})

Eventf implements record.EventRecorder.

func (*EventRecorder) PastEventf

func (e *EventRecorder) PastEventf(object runtime.Object, _ v1.Time, eventtype, reason, _ string, _ ...interface{})

PastEventf implements record.EventRecorder.

type RestartableManagerRecorder

type RestartableManagerRecorder struct {
	Restarts []bool
}

RestartableManagerRecorder records whether each instance of Restart was forced.

func (*RestartableManagerRecorder) Restart

Restart implements watch.RestartableManager.

Jump to

Keyboard shortcuts

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