testutil

package
v1.20.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeClientWrapper

type FakeClientWrapper struct {

	// Set these functions if you want to override the default fakeClient behavior
	GetFunc    func(ctx context.Context, key client.ObjectKey, obj runtime.Object) error
	CreateFunc func(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error
	UpdateFunc func(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error
	DeleteFunc func(ctx context.Context, obj runtime.Object, opts ...client.DeleteOption) error
	ListFunc   func(ctx context.Context, list runtime.Object, opts ...client.ListOption) error
	// contains filtered or unexported fields
}

FakeClientWrapper allows functions to be replaced for fault injection

func NewFakeClientWrapper

func NewFakeClientWrapper(fakeClient client.Client) *FakeClientWrapper

NewFakeClientWrapper creates a FakeClientWrapper

func (*FakeClientWrapper) Create

func (w *FakeClientWrapper) Create(ctx context.Context, obj runtime.Object, opts ...client.CreateOption) error

Create saves the object obj in the Kubernetes cluster.

func (*FakeClientWrapper) Delete

func (w *FakeClientWrapper) Delete(ctx context.Context, obj runtime.Object, opts ...client.DeleteOption) error

Delete deletes the given obj from Kubernetes cluster.

func (*FakeClientWrapper) DeleteAllOf

func (w *FakeClientWrapper) DeleteAllOf(ctx context.Context, obj runtime.Object, opts ...client.DeleteAllOfOption) error

DeleteAllOf deletes all objects of the given type matching the given options.

func (*FakeClientWrapper) Get

Get retrieves an obj for the given object key from the Kubernetes Cluster.

func (*FakeClientWrapper) List

func (w *FakeClientWrapper) List(ctx context.Context, list runtime.Object, opts ...client.ListOption) error

List retrieves list of objects for a given namespace and list options.

func (*FakeClientWrapper) Patch

func (w *FakeClientWrapper) Patch(ctx context.Context, obj runtime.Object, patch client.Patch, opts ...client.PatchOption) error

Patch patches the given obj in the Kubernetes cluster.

func (*FakeClientWrapper) Status

Status returns a StatusWriter which knows how to update status subresource of a Kubernetes object.

func (*FakeClientWrapper) Update

func (w *FakeClientWrapper) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error

Update updates the given obj in the Kubernetes cluster.

Jump to

Keyboard shortcuts

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