fake

package
v0.0.0-...-34a3a48 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package fake ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterWithLabels

func FilterWithLabels(objs []runtime.Object, labelSel labels.Selector) ([]runtime.Object, error)

FilterWithLabels returns a copy of the items in objs matching labelSel.

func NewFakeClient

func NewFakeClient(initObjs ...runtime.Object) client.WithWatch

NewFakeClient creates a new fake client for testing. You can choose to initialize it with a slice of runtime.Object.

func RequiresExactMatch

func RequiresExactMatch(sel fields.Selector) bool

RequiresExactMatch checks if the given field selector is of the form `k=v` or `k==v`.

Types

type ClientBuilder

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

ClientBuilder builds a fake client.

func NewClientBuilder

func NewClientBuilder() *ClientBuilder

NewClientBuilder returns a new builder to create a fake client.

func (*ClientBuilder) Build

func (f *ClientBuilder) Build() client.WithWatch

Build builds and returns a new fake client.

func (*ClientBuilder) WithIndex

func (f *ClientBuilder) WithIndex(obj runtime.Object, field string, extractValue client.IndexerFunc) *ClientBuilder

WithIndex can be optionally used to register an index with name `field` and indexer `extractValue` for API objects of the same GroupVersionKind (GVK) as `obj` in the fake client. It can be invoked multiple times, both with objects of the same GVK or different ones. Invoking WithIndex twice with the same `field` and GVK (via `obj`) arguments will panic. WithIndex retrieves the GVK of `obj` using the scheme registered via WithScheme if WithScheme was previously invoked, the default scheme otherwise.

func (*ClientBuilder) WithInterceptorFuncs

func (f *ClientBuilder) WithInterceptorFuncs(interceptorFuncs interceptor.Funcs) *ClientBuilder

WithInterceptorFuncs configures the client methods to be intercepted using the provided interceptor.Funcs.

func (*ClientBuilder) WithLists

func (f *ClientBuilder) WithLists(initLists ...client.ObjectList) *ClientBuilder

WithLists can be optionally used to initialize this fake client with client.ObjectList(s).

func (*ClientBuilder) WithObjectTracker

func (f *ClientBuilder) WithObjectTracker(ot testing.ObjectTracker) *ClientBuilder

WithObjectTracker can be optionally used to initialize this fake client with testing.ObjectTracker.

func (*ClientBuilder) WithObjects

func (f *ClientBuilder) WithObjects(initObjs ...client.Object) *ClientBuilder

WithObjects can be optionally used to initialize this fake client with client.Object(s).

func (*ClientBuilder) WithRESTMapper

func (f *ClientBuilder) WithRESTMapper(restMapper meta.RESTMapper) *ClientBuilder

WithRESTMapper sets this builder's restMapper. The restMapper is directly set as mapper in the Client. This can be used for example with a meta.DefaultRESTMapper to provide a static rest mapping. If not set, defaults to an empty meta.DefaultRESTMapper.

func (*ClientBuilder) WithRuntimeObjects

func (f *ClientBuilder) WithRuntimeObjects(initRuntimeObjs ...runtime.Object) *ClientBuilder

WithRuntimeObjects can be optionally used to initialize this fake client with runtime.Object(s).

func (*ClientBuilder) WithScheme

func (f *ClientBuilder) WithScheme(scheme *runtime.Scheme) *ClientBuilder

WithScheme sets this builder's internal scheme. If not set, defaults to client-go's global scheme.Scheme.

func (*ClientBuilder) WithStatusSubresource

func (f *ClientBuilder) WithStatusSubresource(o ...client.Object) *ClientBuilder

WithStatusSubresource configures the passed object with a status subresource, which means calls to Update and Patch will not alter its status.

Directories

Path Synopsis
Package fake ...
Package fake ...
Package fake ...
Package fake ...
Package fake ...
Package fake ...

Jump to

Keyboard shortcuts

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