Documentation
¶
Overview ¶
Package clocktest provides a manually driven util.Clock for tests: time only moves when the test calls Advance or Set, so polling, backoff and debounce run without sleeps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock struct {
// contains filtered or unexported fields
}
Clock is a fake util.Clock. The zero value is not usable; use New.
func (*Clock) Advance ¶
Advance moves the clock forward by d and fires every timer and ticker that falls due, in time order. Tickers fire once per period passed; like time.Ticker, ticks are dropped while the channel is full.
func (*Clock) BlockUntil ¶
BlockUntil blocks until at least n timers or tickers are active, so a test can wait for a goroutine to reach its next wait before advancing the clock.