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) context.Contextdeprecated
- 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 BeholderTester
- 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 Context
deprecated
Deprecated: use *testing.T.Context
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
func SkipFlakey ¶ added in v0.4.0
Types ¶
type BeholderTester ¶ added in v0.6.0
type BeholderTester struct {
// contains filtered or unexported fields
}
BeholderTester is a test helper that provides assertion methods on received messages within the beholder client.
func Beholder ¶ added in v0.6.0
func Beholder(t *testing.T) BeholderTester
Beholder sets the global beholder client as a message collector and returns a tester that provides helper assertion functions on received messages.
Beholder affects the whole process, it cannot be used in parallel tests or tests with parallel ancestors.