fake

package
v1.76.4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientMap

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

ClientMap is a simple implementation of clientmap.ClientMap which can be used to fake ClientMaps in unit tests.

func NewClientMap

func NewClientMap() *ClientMap

NewClientMap creates a new empty ClientMap.

func NewClientMapWithClientSets

func NewClientMapWithClientSets(clientSets map[clientmap.ClientSetKey]kubernetes.Interface) *ClientMap

NewClientMapWithClientSets creates a new ClientMap containing the given ClientSets.

func (*ClientMap) AddClient

AddClient adds the given ClientSet to the fake ClientMap with the given key.

func (*ClientMap) AddRuntimeClient

func (f *ClientMap) AddRuntimeClient(key clientmap.ClientSetKey, c client.Client) *ClientMap

AddRuntimeClient adds a new fake ClientSets containing only the given runtime client to the fake ClientMap with the given key.

func (*ClientMap) GetClient

GetClient returns the ClientSet for the given key if present.

func (*ClientMap) InvalidateClient

func (f *ClientMap) InvalidateClient(key clientmap.ClientSetKey) error

InvalidateClient removes the ClientSet for the given key from the ClientMap if present.

func (*ClientMap) Start

func (f *ClientMap) Start(_ context.Context) error

Start does nothing, as fake ClientMap does not support it.

type ClientMapBuilder

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

ClientMapBuilder can build a fake ClientMap which can be used to fake ClientMaps in unit tests.

func NewClientMapBuilder

func NewClientMapBuilder() *ClientMapBuilder

NewClientMapBuilder constructs a new ClientMapBuilder.

func (*ClientMapBuilder) Build

func (b *ClientMapBuilder) Build() *ClientMap

Build builds the ClientMap using the provided attributes.

func (*ClientMapBuilder) WithClientSetForKey

WithClientSetForKey adds a given ClientSet for the given key to the map of ClientSets, that should be contained in the ClientMap.

func (*ClientMapBuilder) WithClientSets

func (b *ClientMapBuilder) WithClientSets(clientSets map[clientmap.ClientSetKey]kubernetes.Interface) *ClientMapBuilder

WithClientSets set the map of ClientSets, that should be contained in the ClientMap.

func (*ClientMapBuilder) WithRuntimeClientForKey

func (b *ClientMapBuilder) WithRuntimeClientForKey(key clientmap.ClientSetKey, c client.Client) *ClientMapBuilder

WithRuntimeClientForKey adds a ClientSet containing only the given controller-runtime Client for the given key to the map of ClientSets, that should be contained in the ClientMap.

Jump to

Keyboard shortcuts

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