Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 informer 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.