clientfake

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSimpleGeneratedName

func AddSimpleGeneratedName(obj runtime.Object) runtime.Object

AddSimpleGeneratedName returns the given object with a simple generated name added to its metadata. If a name already exists, there is no GenerateName field set, or there is an issue accessing the object's metadata the object is returned unmodified.

func AddSimpleGeneratedNames

func AddSimpleGeneratedNames(objs ...runtime.Object) []runtime.Object

AddSimpleGeneratedNames returns the list objects with simple generated names added to their metadata. If a name already exists, there is no GenerateName field set, or there is an issue accessing the object's metadata the object is returned unmodified.

func BuildSelfLink(groupVersion, plural, namespace, name string) string

BuildSelfLink returns a selflink for the given group version, plural, namespace, and name.

Types

type ClientsetDecorator

type ClientsetDecorator interface {
	// PrependReactor adds a reactor to the beginning of the chain.
	PrependReactor(verb, resource string, reaction testing.ReactionFunc)
}

ClientsetDecorator defines decorator methods for a Clientset.

type Option

type Option func(ClientsetDecorator)

Option configures a ClientsetDecorator

func WithNameGeneration

func WithNameGeneration(tb testing.TB) Option

WithNameGeneration returns a fakeK8sClientOption that configures a Clientset to write generated names to all types on create.

func WithSelfLinks(tb testing.TB) Option

WithSelfLinks returns a fakeClientOption that configures a ClientsetDecorator to write selfLinks to all OLM types on create.

type ReactionForwardingClientsetDecorator

type ReactionForwardingClientsetDecorator struct {
	fake.Clientset
	ReactionChain []testing.Reactor // shadow embedded ReactionChain
	// contains filtered or unexported fields
}

ReactionForwardingClientsetDecorator wraps a Clientset and "forwards" Action object mutations from all successful non-handling Reactors along the chain to the first handling Reactor. This is is a stopgap until we can upgrade to client-go v11.0, where the behavior is the default (see https://github.com/kubernetes/client-go/blob/6ee68ca5fd8355d024d02f9db0b3b667e8357a0f/testing/fake.go#L130).

func NewReactionForwardingClientsetDecorator

func NewReactionForwardingClientsetDecorator(objects []runtime.Object, options ...Option) *ReactionForwardingClientsetDecorator

NewReactionForwardingClientsetDecorator returns the ReactionForwardingClientsetDecorator wrapped Clientset result of calling NewSimpleClientset with the given objects.

func (*ReactionForwardingClientsetDecorator) PrependReactor

func (c *ReactionForwardingClientsetDecorator) PrependReactor(verb, resource string, reaction testing.ReactionFunc)

PrependReactor adds a reactor to the beginning of the chain.

Jump to

Keyboard shortcuts

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