fake

package
v0.15.0-m3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package fake provides fake dynamic clients and reactors for testing purposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDeleteCollectionReactor added in v0.6.2

func AddDeleteCollectionReactor(f *testing.Fake, gvk schema.GroupVersionKind)

func AddFilteringListReactor added in v0.12.0

func AddFilteringListReactor(f *testing.Fake)

func ConflictOnUpdateReactor added in v0.12.0

func ConflictOnUpdateReactor(f *testing.Fake, resource string)

func FailingReaction added in v0.14.0

func FailingReaction(err error) func(obj interface{}) (bool, error)

Types

type DeleteCollectionReactor added in v0.6.2

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

type DynamicClient added in v0.9.0

type DynamicClient struct {
	*fake.FakeDynamicClient
	// contains filtered or unexported fields
}

func NewDynamicClient

func NewDynamicClient(scheme *runtime.Scheme, objects ...runtime.Object) *DynamicClient

func (*DynamicClient) Resource added in v0.9.0

type DynamicResourceClient

type DynamicResourceClient struct {
	dynamic.ResourceInterface

	FailOnCreate                 error
	PersistentFailOnCreate       atomic.Value
	FailOnUpdate                 error
	PersistentFailOnUpdate       atomic.Value
	CheckResourceVersionOnUpdate bool
	FailOnDelete                 error
	PersistentFailOnDelete       atomic.Value
	FailOnGet                    error
	PersistentFailOnGet          atomic.Value
	// contains filtered or unexported fields
}

func (*DynamicResourceClient) Create

func (*DynamicResourceClient) Delete

func (f *DynamicResourceClient) Delete(ctx context.Context, name string,
	options v1.DeleteOptions,
	subresources ...string,
) error

func (*DynamicResourceClient) Get

func (f *DynamicResourceClient) Get(ctx context.Context, name string, options v1.GetOptions,
	subresources ...string,
) (*unstructured.Unstructured, error)

func (*DynamicResourceClient) Update

func (*DynamicResourceClient) VerifyNoCreate

func (f *DynamicResourceClient) VerifyNoCreate(name string)

func (*DynamicResourceClient) VerifyNoDelete

func (f *DynamicResourceClient) VerifyNoDelete(name string)

func (*DynamicResourceClient) VerifyNoUpdate

func (f *DynamicResourceClient) VerifyNoUpdate(name string)

type FailOnActionReactor added in v0.12.0

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

func FailOnAction added in v0.12.0

func FailOnAction(f *testing.Fake, resource, verb string, customErr error, autoReset bool) *FailOnActionReactor

func (*FailOnActionReactor) Fail added in v0.12.0

func (r *FailOnActionReactor) Fail(v bool)

type FailingReactor added in v0.6.1

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

func NewFailingReactor added in v0.6.1

func NewFailingReactor(f *testing.Fake) *FailingReactor

func NewFailingReactorForResource added in v0.6.1

func NewFailingReactorForResource(f *testing.Fake, resource string) *FailingReactor

func (*FailingReactor) SetFailOnCreate added in v0.6.1

func (f *FailingReactor) SetFailOnCreate(err error)

func (*FailingReactor) SetFailOnDelete added in v0.6.1

func (f *FailingReactor) SetFailOnDelete(err error)

func (*FailingReactor) SetFailOnGet added in v0.6.1

func (f *FailingReactor) SetFailOnGet(err error)

func (*FailingReactor) SetFailOnList added in v0.6.1

func (f *FailingReactor) SetFailOnList(err error)

func (*FailingReactor) SetFailOnUpdate added in v0.6.1

func (f *FailingReactor) SetFailOnUpdate(err error)

func (*FailingReactor) SetResetOnFailure added in v0.6.1

func (f *FailingReactor) SetResetOnFailure(v bool)

type ReactingClient added in v0.14.0

type ReactingClient struct {
	client.Client
	// contains filtered or unexported fields
}

func NewReactingClient added in v0.14.0

func NewReactingClient(c client.Client) *ReactingClient

func (*ReactingClient) AddReactor added in v0.14.0

func (c *ReactingClient) AddReactor(verb VerbType, objType interface{}, r ReactionFunc) *ReactingClient

func (*ReactingClient) Create added in v0.14.0

func (c *ReactingClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (*ReactingClient) Delete added in v0.14.0

func (c *ReactingClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

func (*ReactingClient) Get added in v0.14.0

func (*ReactingClient) List added in v0.14.0

func (c *ReactingClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

func (*ReactingClient) Update added in v0.14.0

func (c *ReactingClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

type ReactionFunc added in v0.14.0

type ReactionFunc func(obj interface{}) (bool, error)

type VerbType added in v0.14.0

type VerbType int
const (
	Get VerbType = iota
	List
	Create
	Update
	Delete
)

type WatchReactor added in v0.10.1

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

func NewWatchReactor added in v0.10.1

func NewWatchReactor(f *testing.Fake) *WatchReactor

func (*WatchReactor) AwaitNoWatchStarted added in v0.10.1

func (r *WatchReactor) AwaitNoWatchStarted(forResource string)

func (*WatchReactor) AwaitNoWatchStopped added in v0.10.1

func (r *WatchReactor) AwaitNoWatchStopped(forResource string)

func (*WatchReactor) AwaitWatchStarted added in v0.10.1

func (r *WatchReactor) AwaitWatchStarted(forResource string)

func (*WatchReactor) AwaitWatchStopped added in v0.10.1

func (r *WatchReactor) AwaitWatchStopped(forResource string)

Jump to

Keyboard shortcuts

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