testutils

package
v0.5.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectEvent

func ExpectEvent(recorder *record.FakeRecorder, reason string)

func ExpectEvents

func ExpectEvents(recorder *record.FakeRecorder, reasons ...string)

ExpectEvents checks for given reasons in arbitrary order

func HaveBodyEqualTo

func HaveBodyEqualTo(expected interface{}) types.GomegaMatcher

func HaveStatusCode

func HaveStatusCode(expected interface{}) types.GomegaMatcher

func NewFakeInformerFor

func NewFakeInformerFor(obj runtime.Object) (cache.SharedIndexInformer, *framework.FakeControllerSource)

func RepresentMimeType

func RepresentMimeType(expected interface{}) types.GomegaMatcher

Types

type DomainFeeder

type DomainFeeder struct {
	MockQueue *MockWorkQueue
	Source    *framework.FakeControllerSource
}

func NewDomainFeeder

func NewDomainFeeder(queue *MockWorkQueue, source *framework.FakeControllerSource) *DomainFeeder

func (*DomainFeeder) Add

func (v *DomainFeeder) Add(vm *api.Domain)

func (*DomainFeeder) Delete

func (v *DomainFeeder) Delete(vm *api.Domain)

func (*DomainFeeder) Modify

func (v *DomainFeeder) Modify(vm *api.Domain)

type MockWorkQueue

type MockWorkQueue struct {
	workqueue.RateLimitingInterface
	// contains filtered or unexported fields
}

MockWorkQueue is a helper workqueue which can be wrapped around any RateLimitingInterface implementing queue. This allows synchronous testing of the controller. The typical pattern is:

MockQueue.ExpectAdd(3)
vmSource.Add(vm)
vmSource.Add(vm1)
vmSource.Add(vm2)
MockQueue.Wait()

This ensures that Source callbacks which are listening on vmSource enqueued three times an object. Since enqueing is typically the last action in listener callbacks, we can assume that the wanted scenario for a controller is set up, and an execution will process this scenario.

func NewMockWorkQueue

func NewMockWorkQueue(queue workqueue.RateLimitingInterface) *MockWorkQueue

func (*MockWorkQueue) Add

func (q *MockWorkQueue) Add(obj interface{})

func (*MockWorkQueue) ExpectAdds

func (q *MockWorkQueue) ExpectAdds(diff int)

ExpectAdds allows setting the amount of expected enqueues.

func (*MockWorkQueue) Wait

func (q *MockWorkQueue) Wait()

Wait waits until the expected amount of ExpectedAdds has happened. It will not block if there were no expectations set.

type PodFeeder added in v0.5.0

type PodFeeder struct {
	MockQueue *MockWorkQueue
	Source    *framework.FakeControllerSource
}

func NewPodFeeder added in v0.5.0

func NewPodFeeder(queue *MockWorkQueue, source *framework.FakeControllerSource) *PodFeeder

func (*PodFeeder) Add added in v0.5.0

func (v *PodFeeder) Add(pod *k8sv1.Pod)

func (*PodFeeder) Delete added in v0.5.0

func (v *PodFeeder) Delete(pod *k8sv1.Pod)

func (*PodFeeder) Modify added in v0.5.0

func (v *PodFeeder) Modify(pod *k8sv1.Pod)

type VirtualMachineFeeder

type VirtualMachineFeeder struct {
	MockQueue *MockWorkQueue
	Source    *framework.FakeControllerSource
}

func NewVirtualMachineFeeder

func NewVirtualMachineFeeder(queue *MockWorkQueue, source *framework.FakeControllerSource) *VirtualMachineFeeder

func (*VirtualMachineFeeder) Add

func (*VirtualMachineFeeder) Delete

func (v *VirtualMachineFeeder) Delete(vm *v1.VirtualMachine)

func (*VirtualMachineFeeder) Modify

func (v *VirtualMachineFeeder) Modify(vm *v1.VirtualMachine)

Jump to

Keyboard shortcuts

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