testing

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFakeMapper

func NewFakeMapper(scheme *runtime.Scheme) meta.RESTMapper

NewFakeMapper creates a new fake mapper

func NewScheme

func NewScheme() *runtime.Scheme

NewScheme creates a new scheme

Types

type FakeIndexClient

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

func NewFakeClient

func NewFakeClient(scheme *runtime.Scheme, objs ...runtime.Object) *FakeIndexClient

NewFakeClient creates a new fake client for the standard schema

func (*FakeIndexClient) Create

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

func (*FakeIndexClient) Delete

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

func (*FakeIndexClient) DeleteAllOf

func (fc *FakeIndexClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

func (*FakeIndexClient) Get

func (*FakeIndexClient) List

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

func (*FakeIndexClient) Patch

func (fc *FakeIndexClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

func (*FakeIndexClient) SetIndexValue

func (fc *FakeIndexClient) SetIndexValue(gvk schema.GroupVersionKind, index string, value string, objs []runtime.Object)

func (*FakeIndexClient) Update

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

type FakeInformer

type FakeInformer struct {
	// NotSynced is returned by the HasSynced functions to implement the Informer interface
	NotSynced bool

	// RunCount is incremented each time RunInformersAndControllers is called
	RunCount int
	// contains filtered or unexported fields
}

FakeInformer provides fake Informer functionality for testing

func (*FakeInformer) Add

func (f *FakeInformer) Add(obj metav1.Object)

Add fakes an Add event for obj

func (*FakeInformer) AddEventHandler

func (f *FakeInformer) AddEventHandler(handler cache.ResourceEventHandler)

AddEventHandler implements the Informer interface. Adds an EventHandler to the fake Informers.

func (*FakeInformer) AddEventHandlerWithResyncPeriod

func (f *FakeInformer) AddEventHandlerWithResyncPeriod(handler cache.ResourceEventHandler, resyncPeriod time.Duration)

AddEventHandlerWithResyncPeriod does nothing.

func (*FakeInformer) AddIndexers

func (f *FakeInformer) AddIndexers(indexers cache.Indexers) error

AddIndexers does nothing. TODO(community): Implement this.

func (*FakeInformer) Delete

func (f *FakeInformer) Delete(obj metav1.Object)

Delete fakes an Delete event for obj

func (*FakeInformer) GetController

func (f *FakeInformer) GetController() cache.Controller

GetController does nothing. TODO(community): Implement this.

func (*FakeInformer) GetIndexer

func (f *FakeInformer) GetIndexer() cache.Indexer

GetIndexer does nothing. TODO(community): Implement this.

func (*FakeInformer) GetStore

func (f *FakeInformer) GetStore() cache.Store

GetStore does nothing. TODO(community): Implement this.

func (*FakeInformer) HasSynced

func (f *FakeInformer) HasSynced() bool

HasSynced implements the Informer interface. Returns f.Synced

func (*FakeInformer) Informer

func (f *FakeInformer) Informer() cache.SharedIndexInformer

Informer returns the fake Informer.

func (*FakeInformer) LastSyncResourceVersion

func (f *FakeInformer) LastSyncResourceVersion() string

LastSyncResourceVersion does nothing. TODO(community): Implement this.

func (*FakeInformer) Run

func (f *FakeInformer) Run(<-chan struct{})

Run implements the Informer interface. Increments f.RunCount

func (*FakeInformer) SetWatchErrorHandler

func (f *FakeInformer) SetWatchErrorHandler(handler cache.WatchErrorHandler) error

func (*FakeInformer) Update

func (f *FakeInformer) Update(oldObj, newObj metav1.Object)

Update fakes an Update event for obj

type FakeInformers

type FakeInformers struct {
	InformersByGVK map[schema.GroupVersionKind]toolscache.SharedIndexInformer
	Scheme         *runtime.Scheme
	Error          error
	Synced         *bool
}

FakeInformers is a fake implementation of Informers

func NewFakeCache

func NewFakeCache(scheme *runtime.Scheme) *FakeInformers

NewFakeCache creates a new fake cache

func (*FakeInformers) FakeInformerFor

func (c *FakeInformers) FakeInformerFor(ctx context.Context, obj client.Object) (*FakeInformer, error)

FakeInformerFor implements Informers

func (*FakeInformers) FakeInformerForKind

func (c *FakeInformers) FakeInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (*FakeInformer, error)

FakeInformerForKind implements Informers

func (*FakeInformers) Get

Get implements Cache

func (*FakeInformers) GetInformer

func (c *FakeInformers) GetInformer(ctx context.Context, obj client.Object) (cache.Informer, error)

GetInformer implements Informers

func (*FakeInformers) GetInformerForKind

func (c *FakeInformers) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (cache.Informer, error)

GetInformerForKind implements Informers

func (*FakeInformers) IndexField

func (c *FakeInformers) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error

IndexField implements Cache

func (*FakeInformers) List

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

List implements Cache

func (*FakeInformers) Start

func (c *FakeInformers) Start(ctx context.Context) error

Start implements Informers

func (*FakeInformers) WaitForCacheSync

func (c *FakeInformers) WaitForCacheSync(ctx context.Context) bool

WaitForCacheSync implements Informers

type FakeManager

type FakeManager struct {
	Scheme *runtime.Scheme
	Client client.Client
	Cache  *FakeInformers
	Mapper meta.RESTMapper
}

func NewFakeManager

func NewFakeManager() *FakeManager

func (*FakeManager) Add

func (fm *FakeManager) Add(manager.Runnable) error

func (*FakeManager) AddHealthzCheck

func (fm *FakeManager) AddHealthzCheck(name string, check healthz.Checker) error

func (*FakeManager) AddMetricsExtraHandler

func (fm *FakeManager) AddMetricsExtraHandler(path string, handler http.Handler) error

func (*FakeManager) AddReadyzCheck

func (fm *FakeManager) AddReadyzCheck(name string, check healthz.Checker) error

func (*FakeManager) Elected

func (fm *FakeManager) Elected() <-chan struct{}

func (*FakeManager) GetAPIReader

func (fm *FakeManager) GetAPIReader() client.Reader

func (*FakeManager) GetCache

func (fm *FakeManager) GetCache() cache.Cache

func (*FakeManager) GetClient

func (fm *FakeManager) GetClient() client.Client

func (*FakeManager) GetConfig

func (fm *FakeManager) GetConfig() *rest.Config

func (*FakeManager) GetControllerOptions added in v0.2.7

func (fm *FakeManager) GetControllerOptions() v1alpha1.ControllerConfigurationSpec

func (*FakeManager) GetEventRecorderFor

func (fm *FakeManager) GetEventRecorderFor(name string) record.EventRecorder

func (*FakeManager) GetFieldIndexer

func (fm *FakeManager) GetFieldIndexer() client.FieldIndexer

func (*FakeManager) GetLogger

func (fm *FakeManager) GetLogger() logr.Logger

func (*FakeManager) GetRESTMapper

func (fm *FakeManager) GetRESTMapper() meta.RESTMapper

func (*FakeManager) GetScheme

func (fm *FakeManager) GetScheme() *runtime.Scheme

func (*FakeManager) GetWebhookServer

func (fm *FakeManager) GetWebhookServer() *webhook.Server

func (*FakeManager) SetFields

func (fm *FakeManager) SetFields(interface{}) error

func (*FakeManager) Start

func (fm *FakeManager) Start(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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