Documentation ¶
Index ¶
- Constants
- func AssertEventually(t *testing.T, f func() bool)
- func AssertLogCountEventually(t *testing.T, observedLogs *observer.ObservedLogs, msg string, count int)
- func AssertLogEventually(t *testing.T, observedLogs *observer.ObservedLogs, msg string)
- func Context(tb TestingT) (ctx context.Context)
- func RequireLogMessage(t *testing.T, observedLogs *observer.ObservedLogs, msg string)
- func RequireSignal(t *testing.T, ch <-chan struct{}, failMsg string)
- func SkipFlakey(t *testing.T, ticketURL string)
- func SkipShort(tb testing.TB, why string)
- func WaitTimeout(t *testing.T) time.Duration
- type TestingT
Constants ¶
const DefaultWaitTimeout = 30 * time.Second
DefaultWaitTimeout is the default wait timeout. If you have a *testing.T, use WaitTimeout instead.
const TestInterval = 100 * time.Millisecond
TestInterval is just a sensible poll interval that gives fast tests without risk of spamming
Variables ¶
This section is empty.
Functions ¶
func AssertEventually ¶
AssertEventually waits for f to return true
func AssertLogCountEventually ¶
func AssertLogCountEventually(t *testing.T, observedLogs *observer.ObservedLogs, msg string, count int)
AssertLogCountEventually waits until at least count log message containing the specified msg is emitted
func AssertLogEventually ¶
func AssertLogEventually(t *testing.T, observedLogs *observer.ObservedLogs, msg string)
AssertLogEventually waits until at least one log message containing the specified msg is emitted. NOTE: This does not "pop" messages so it cannot be used multiple times to check for new instances of the same msg. See AssertLogCountEventually instead.
Get a *observer.ObservedLogs like so:
observedZapCore, observedLogs := observer.New(zap.DebugLevel) lggr := logger.TestLogger(t, observedZapCore)
func RequireLogMessage ¶
func RequireLogMessage(t *testing.T, observedLogs *observer.ObservedLogs, msg string)
RequireLogMessage fails the test if emitted logs don't contain the given message
func RequireSignal ¶
RequireSignal waits for the channel to close (or receive anything) and fatals the test if the default wait timeout is exceeded