fakeext

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDynamicClientWithExtensions

func NewDynamicClientWithExtensions(scheme *runtime.Scheme, objs []runtime.Object, exts []Extension) (dynamic.Interface, error)

NewDynamicClientWithExtensions creates a client-go/dynamic.Interface mock with the given extensions.

func NewKubernetesClientsetWithExtensions

func NewKubernetesClientsetWithExtensions(objs []runtime.Object, exts []Extension) (kubernetes.Interface, error)

NewKubernetesClientsetWithExtensions creates a client-go/kubernetes.Interface mock with the given extensions.

Types

type Extension

type Extension interface {
	// OnInitial runs over the set of initial objects provided to the mock
	// client.
	OnInitial(objs []runtime.Object) error

	// OnNewFake runs when the mock client is actually created.
	OnNewFake(f Fake) error
}

Extension allows for predefined customization of a mock Kubernetes client.

var SetUIDExtension Extension = &setUIDExtension{}

SetUIDExtension automatically sets the UID field of the object's metadata to a randomly-generated UUID when an object is created.

type Fake

type Fake interface {
	Actions() []testing.Action
	AddProxyReactor(resource string, reaction testing.ProxyReactionFunc)
	AddReactor(verb, resource string, reaction testing.ReactionFunc)
	AddWatchReactor(resource string, reaction testing.WatchReactionFunc)
	ClearActions()
	Invokes(action testing.Action, defaultReturnObj runtime.Object) (runtime.Object, error)
	InvokesProxy(action testing.Action) rest.ResponseWrapper
	InvokesWatch(action testing.Action) (watch.Interface, error)
	PrependProxyReactor(resource string, reaction testing.ProxyReactionFunc)
	PrependReactor(verb, resource string, reaction testing.ReactionFunc)
	PrependWatchReactor(resource string, reaction testing.WatchReactionFunc)
}

Fake is an interface to wrap client-go/testing.Fake, which is embedded into many fake clientsets.

Jump to

Keyboard shortcuts

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