Documentation ¶
Index ¶
- func BeValidUUID() types.GomegaMatcher
- func RunTestWithTimeout(f func(), d time.Duration)
- type AsyncTestHelper
- func (helper *AsyncTestHelper) ExpectAndNotifyCallback() func(...interface{})
- func (helper *AsyncTestHelper) ExpectAndNotifyCallbackWithName(name string) func(...interface{})
- func (helper *AsyncTestHelper) RegisterCalls(calls ...*gomock.Call)
- func (helper *AsyncTestHelper) RunTestWithTimeout(f func(), d time.Duration)
- func (helper *AsyncTestHelper) Setup()
- func (helper *AsyncTestHelper) WaitWithTimeout(d time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeValidUUID ¶
func BeValidUUID() types.GomegaMatcher
BeValidUUID returns a gomega matcher that checks validity of a UUID string
func RunTestWithTimeout ¶
RunTestWithTimeout runs function f until provided timeout. If the function times out, it will cause the ginkgo test to fail.
Types ¶
type AsyncTestHelper ¶
type AsyncTestHelper struct {
// contains filtered or unexported fields
}
AsyncTestHelper provides synchronization methods to test goroutines. Example:
var ( asyncHelper testutils.AsyncTestHelper ) BeforeEach(func() { mockMyInterface.EXPECT().MyMethodInGoroutine().Do(asyncHelper.ExpectAndNotifyCallback()) }) AfterEach(func() { asyncHelper.WaitWithTimeout(time.Second) })
func (*AsyncTestHelper) ExpectAndNotifyCallback ¶
func (helper *AsyncTestHelper) ExpectAndNotifyCallback() func(...interface{})
ExpectAndNotifyCallback Adds one to this helper's WaitGroup, and provides a callback that calls Done on it. Should be used for gomock Do calls that trigger via mocked functions executed in a goroutine.
func (*AsyncTestHelper) ExpectAndNotifyCallbackWithName ¶
func (helper *AsyncTestHelper) ExpectAndNotifyCallbackWithName(name string) func(...interface{})
ExpectAndNotifyCallback Adds one to this helper's WaitGroup, and provides a callback that calls Done on it. Should be used for gomock Do calls that trigger via mocked functions executed in a goroutine.
func (*AsyncTestHelper) RegisterCalls ¶
func (helper *AsyncTestHelper) RegisterCalls(calls ...*gomock.Call)
RegisterCalls registers a number of calls to this async helper, so that they are waited for.
func (*AsyncTestHelper) RunTestWithTimeout ¶
func (helper *AsyncTestHelper) RunTestWithTimeout(f func(), d time.Duration)
RunTestWithTimeout runs function f until provided timeout. If the function times out, it will cause the ginkgo test to fail.
func (*AsyncTestHelper) Setup ¶
func (helper *AsyncTestHelper) Setup()
func (*AsyncTestHelper) WaitWithTimeout ¶
func (helper *AsyncTestHelper) WaitWithTimeout(d time.Duration)
WaitWithTimeout waits for this helper's WaitGroup until provided timeout. Should wait for all ExpectAndNotifyCallback callbacks, registered in asynchronous mocks calls