controllertest

package
v0.2.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package controllertest contains fake informers for testing controllers When in doubt, it's almost always better to test against a real API server using envtest.Environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorType

type ErrorType struct{}

ErrorType implements runtime.Object but isn't registered in any scheme and should cause errors in tests as a result.

func (ErrorType) DeepCopyObject

func (ErrorType) DeepCopyObject() runtime.Object

DeepCopyObject implements runtime.Object

func (ErrorType) GetObjectKind

func (ErrorType) GetObjectKind() schema.ObjectKind

GetObjectKind implements runtime.Object

type FakeInformer

type FakeInformer struct {
	// Synced is returned by the HasSynced functions to implement the Informer interface
	Synced 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. TODO(community): Implement this.

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) Update

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

Update fakes an Update event for obj

type Queue

type Queue struct {
	workqueue.Interface
}

Queue implements a RateLimiting queue as a non-ratelimited queue for testing. This helps testing by having functions that use a RateLimiting queue synchronously add items to the queue.

func (Queue) AddAfter

func (q Queue) AddAfter(item interface{}, duration time.Duration)

AddAfter implements RateLimitingInterface.

func (Queue) AddRateLimited

func (q Queue) AddRateLimited(item interface{})

AddRateLimited implements RateLimitingInterface. TODO(community): Implement this.

func (Queue) Forget

func (q Queue) Forget(item interface{})

Forget implements RateLimitingInterface. TODO(community): Implement this.

func (Queue) NumRequeues

func (q Queue) NumRequeues(item interface{}) int

NumRequeues implements RateLimitingInterface. TODO(community): Implement this.

Jump to

Keyboard shortcuts

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