fakeclient

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0, BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoreClientSet

func NewCoreClientSet(objects ...runtime.Object) (*Clientset, *FakeObjectTracker)

NewCoreClientSet returns a clientset that will respond with the provided objects. It's backed by a very simple object tracker that processes creates, updates and deletions as-is, without applying any validations and/or defaults. It shouldn't be considered a replacement for a real clientset and is mostly useful in simple unit tests.

Types

type Actions

type Actions struct {
	Create string
	Get    error
	Delete string
	Update string
}

Actions contains the actions whose response can be faked

type Clientset

type Clientset struct {
	*k8sfake.Clientset
	FakeDiscovery *fakediscovery.FakeDiscovery
}

Clientset extends k8sfake.Clientset to override the Policy implementation. This is because the default Policy fake implementation does not propagate the eviction name.

func (*Clientset) Discovery

func (c *Clientset) Discovery() discovery.DiscoveryInterface

Discovery returns the fake discovery implementation.

func (*Clientset) Policy

Policy retrieves the PolicyV1beta1Client

func (*Clientset) PolicyV1beta1

func (c *Clientset) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface

PolicyV1beta1 retrieves the PolicyV1beta1Client

type FakeEvictions

type FakeEvictions struct {
	*fakepolicyv1beta1.FakePolicyV1beta1
	// contains filtered or unexported fields
}

FakeEvictions extends fakepolicyv1beta1.FakeEvictions to override the Policy implementation. This is because the default Policy fake implementation does not propagate the eviction name.

func (*FakeEvictions) Evict

func (c *FakeEvictions) Evict(ctx context.Context, eviction *apipolicyv1beta1.Eviction) error

Evict overrides the fakepolicyv1beta1.FakeEvictions to override the Policy implementation. This is because the default Policy fake implementation does not propagate the eviction name.

type FakeObjectTracker

type FakeObjectTracker struct {
	*watch.FakeWatcher
	// contains filtered or unexported fields
}

FakeObjectTracker implements both k8stesting.ObjectTracker as well as watch.Interface.

func NewMachineClientSet

func NewMachineClientSet(objects ...runtime.Object) (*fakeuntyped.Clientset, *FakeObjectTracker)

NewMachineClientSet returns a clientset that will respond with the provided objects. It's backed by a very simple object tracker that processes creates, updates and deletions as-is, without applying any validations and/or defaults. It shouldn't be considered a replacement for a real clientset and is mostly useful in simple unit tests.

func (*FakeObjectTracker) Add

func (t *FakeObjectTracker) Add(obj runtime.Object) error

Add receives an add event with the object

func (*FakeObjectTracker) ClearOptions

func (o *FakeObjectTracker) ClearOptions() error

ClearOptions clears any faking options that have been sets

func (*FakeObjectTracker) Create

Create receives an create event with the object

func (*FakeObjectTracker) DecrementCounter

func (o *FakeObjectTracker) DecrementCounter() error

func (*FakeObjectTracker) Delete

func (t *FakeObjectTracker) Delete(gvr schema.GroupVersionResource, ns, name string) error

Delete receives an delete event with the object

func (*FakeObjectTracker) Get

Get receives an get event with the object

func (*FakeObjectTracker) List

List receives an list event with the object

func (*FakeObjectTracker) RunFakeInvocations

func (o *FakeObjectTracker) RunFakeInvocations() error

RunFakeInvocations runs any custom fake configurations/methods before invoking standard ObjectTrackers

func (*FakeObjectTracker) SetDelay

func (o *FakeObjectTracker) SetDelay(delay time.Duration) error

SetDelay sets delay while invoking any interface exposed by standard ObjectTrackers

func (*FakeObjectTracker) SetError

func (o *FakeObjectTracker) SetError(message string) error

SetError sets up the errorMessage to be returned on further function calls

func (*FakeObjectTracker) SetFakeResourceActions

func (o *FakeObjectTracker) SetFakeResourceActions(resourceActions *ResourceActions, counter int) error

SetFakeResourceActions sets up the errorMessage to be returned on specific calls

func (*FakeObjectTracker) Start

func (t *FakeObjectTracker) Start() error

Start begins tracking of an FakeObjectTracker

func (*FakeObjectTracker) Stop

func (t *FakeObjectTracker) Stop()

Stop terminates tracking of an FakeObjectTracker

func (*FakeObjectTracker) Update

Update receives an update event with the object

func (*FakeObjectTracker) Watch

Watch receives an watch event with the object

type FakeObjectTrackers

type FakeObjectTrackers struct {
	ControlMachine, ControlCore, TargetCore *FakeObjectTracker
}

FakeObjectTrackers is a struct containing all the controller fake object trackers

func NewFakeObjectTrackers

func NewFakeObjectTrackers(controlMachine, controlCore, targetCore *FakeObjectTracker) *FakeObjectTrackers

NewFakeObjectTrackers initialize's fakeObjectTrackers initializes the fake object trackers

func (*FakeObjectTrackers) Start

func (o *FakeObjectTrackers) Start() error

Start starts all object trackers as go routines

func (*FakeObjectTrackers) Stop

func (o *FakeObjectTrackers) Stop() error

Stop stops all object trackers

type FakePolicyV1beta1

type FakePolicyV1beta1 struct {
	*fakepolicyv1beta1.FakePolicyV1beta1
}

FakePolicyV1beta1 extends fakepolicyv1beta1.FakePolicyV1beta1 to override the Policy implementation. This is because the default Policy fake implementation does not propagate the eviction name.

func (*FakePolicyV1beta1) Evictions

func (c *FakePolicyV1beta1) Evictions(namespace string) policyv1beta1.EvictionInterface

Evictions extends fakepolicyv1beta1.FakeEvictions to override the Policy implementation. This is because the default Policy fake implementation does not propagate the eviction name.

type ResourceActions

type ResourceActions struct {
	Node    Actions
	Machine Actions
}

ResourceActions contains of Kubernetes/Machine resources whose response can be faked

Jump to

Keyboard shortcuts

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