controller-runtime: sigs.k8s.io/controller-runtime/pkg/controller/controllertest Index | Files

package controllertest

import "sigs.k8s.io/controller-runtime/pkg/controller/controllertest"

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

Package Files

doc.go testing.go util.go

type ErrorType Uses

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 Uses

func (ErrorType) DeepCopyObject() runtime.Object

DeepCopyObject implements runtime.Object

func (ErrorType) GetObjectKind Uses

func (ErrorType) GetObjectKind() schema.ObjectKind

GetObjectKind implements runtime.Object

type FakeInformer Uses

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 Uses

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

Add fakes an Add event for obj

func (*FakeInformer) AddEventHandler Uses

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

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

func (*FakeInformer) AddEventHandlerWithResyncPeriod Uses

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

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

func (*FakeInformer) AddIndexers Uses

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

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

func (*FakeInformer) Delete Uses

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

Delete fakes an Delete event for obj

func (*FakeInformer) GetController Uses

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

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

func (*FakeInformer) GetIndexer Uses

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

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

func (*FakeInformer) GetStore Uses

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

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

func (*FakeInformer) HasSynced Uses

func (f *FakeInformer) HasSynced() bool

HasSynced implements the Informer interface. Returns f.Synced

func (*FakeInformer) Informer Uses

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

Informer returns the fake Informer.

func (*FakeInformer) LastSyncResourceVersion Uses

func (f *FakeInformer) LastSyncResourceVersion() string

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

func (*FakeInformer) Run Uses

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

Run implements the Informer interface. Increments f.RunCount

func (*FakeInformer) Update Uses

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

Update fakes an Update event for obj

type Queue Uses

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 Uses

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

AddAfter implements RateLimitingInterface.

func (Queue) AddRateLimited Uses

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

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

func (Queue) Forget Uses

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

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

func (Queue) NumRequeues Uses

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

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

Package controllertest imports 6 packages (graph) and is imported by 5 packages. Updated 2019-09-19. Refresh now. Tools for package owners.