Documentation ¶
Overview ¶
Package clocktest exists to allow interoperability with our Clock interface and the Clockwork FakeClock. Compatibility between Go interfaces is shallow, since function signatures containing other interfaces within an interface will be compared by their exact (nominal) type. Therefore, for the three Clock functions returning Timer or Ticker, we need to wrap those into functions returning the Clockwork version of the interface instead.
We also expose BlockUntilContext directly for convenience, as it is not exposed in Clockwork FakeClock.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeClock ¶
type FakeClock interface { internal.Clock Advance(d time.Duration) BlockUntil(waiters int) BlockUntilContext(ctx context.Context, n int) error }
FakeClock provides an interface for a clock which can be manually advanced through time. For more information, see the documentation for Clockwork. https://pkg.go.dev/github.com/jonboulle/clockwork
func NewFakeClock ¶
func NewFakeClock() FakeClock
NewFakeClock creates a new FakeClock using Clockwork.
func NewFakeClockAt ¶
NewFakeClockAt creates a new FakeClock using Clockwork set to a specific time, to provide fully deterministic clock behavior.