Documentation
¶
Overview ¶
Package clock provides a time abstraction for deterministic testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface {
Now() time.Time
Since(t time.Time) time.Duration
After(d time.Duration) <-chan time.Time
Sleep(d time.Duration)
}
Clock is a source of time. Real wraps the standard library; Fake allows tests to advance time deterministically.
type Fake ¶
type Fake struct {
// contains filtered or unexported fields
}
Fake is a test Clock implementation that wraps clockwork.FakeClock. Use NewFake to create an instance, and Advance to move time forward. Goroutines blocked on After or Sleep will be woken when their deadline is passed by Advance.
func (*Fake) Advance ¶
Advance moves the fake clock forward by d, waking any goroutines blocked on After or Sleep whose deadline has been passed.
Click to show internal directories.
Click to hide internal directories.