Documentation ¶
Index ¶
- Constants
- func Eventually(ctx context.Context, t testing.TB, condition func(context.Context) bool, ...) bool
- func EventuallyLong(t testing.TB, condition func(context.Context) bool) bool
- func EventuallyMedium(t testing.TB, condition func(context.Context) bool) bool
- func EventuallyShort(t testing.TB, condition func(context.Context) bool) bool
Constants ¶
const ( WaitShort = 5 * time.Second WaitMedium = 10 * time.Second WaitLong = 15 * time.Second )
Constants for timing out operations, usable for creating contexts that timeout or in require.Eventually.
const ( IntervalFast = 25 * time.Millisecond IntervalMedium = 250 * time.Millisecond IntervalSlow = time.Second )
Constants for delaying repeated operations, e.g. in require.Eventually.
Variables ¶
This section is empty.
Functions ¶
func Eventually ¶ added in v0.8.3
func Eventually(ctx context.Context, t testing.TB, condition func(context.Context) bool, tick time.Duration) bool
Eventually is like require.Eventually except it allows passing a context into the condition. It is safe to use with `require.*`.
If ctx times out, the test will fail, but not immediately. It is the caller's responsibility to exit early if required.
It is the caller's responsibility to ensure that ctx has a deadline or timeout set. Eventually will panic if this is not the case in order to avoid potentially waiting forever.
condition is not run in a goroutine; use the provided context argument for cancellation if required.
func EventuallyLong ¶ added in v0.8.3
EventuallyLong is a convenience function that runs Eventually with IntervalSlow and times out after WaitLong.
func EventuallyMedium ¶ added in v0.8.3
EventuallyMedium is a convenience function that runs Eventually with IntervalMedium and times out after WaitMedium.
Types ¶
This section is empty.