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 VerifyNoLeaks(t testing.TB)
- func WaitTimeout(t *testing.T) time.Duration
- type BeholderTesterdeprecated
- 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
func VerifyNoLeaks ¶ added in v1.3.0
VerifyNoLeaks verifies that the test does not leak any goroutines. Must be called at the start of the test, before any goroutines have spawned. Cannot be used from parallel tests.
Types ¶
type BeholderTester
deprecated
added in
v0.6.0
type BeholderTester = beholdertest.Observer
Deprecated: use beholdertest.Observer
func Beholder
deprecated
added in
v0.6.0
func Beholder(t *testing.T) BeholderTester
Deprecated: use beholdertest.NewObserver