Documentation ¶
Overview ¶
Package cvtesting reduces boilerplate in tests.
Index ¶
- type DispatchRecorder
- func (d *DispatchRecorder) Clear()
- func (d *DispatchRecorder) Dispatch(target string, eta time.Time)
- func (d *DispatchRecorder) ETAsOf(target string) []time.Time
- func (d *DispatchRecorder) LatestETAof(target string) time.Time
- func (d *DispatchRecorder) PopTargets() []string
- func (d *DispatchRecorder) Targets() []string
- type Test
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DispatchRecorder ¶
type DispatchRecorder struct {
// contains filtered or unexported fields
}
DispatchRecorder records dispatches in memory.
func (*DispatchRecorder) Clear ¶
func (d *DispatchRecorder) Clear()
Clear clears all recorded dispatches.
func (*DispatchRecorder) Dispatch ¶
func (d *DispatchRecorder) Dispatch(target string, eta time.Time)
Dispatch records a dispatch.
func (*DispatchRecorder) ETAsOf ¶
func (d *DispatchRecorder) ETAsOf(target string) []time.Time
ETAsOf returns sorted distinct ETAs for dispatches of the given target.
func (*DispatchRecorder) LatestETAof ¶
func (d *DispatchRecorder) LatestETAof(target string) time.Time
LatestETAof returns the last ETA of the given target.
Panics if the target has no ETAs.
func (*DispatchRecorder) PopTargets ¶
func (d *DispatchRecorder) PopTargets() []string
PopTargets returns sorted list of targets and clears the state.
func (*DispatchRecorder) Targets ¶
func (d *DispatchRecorder) Targets() []string
Targets returns sorted list of targets.
type Test ¶
type Test struct { // GFake is a Gerrit fake. Defaults to an empty one. GFake *gf.Fake // TreeFake is a fake Tree. Defaults to an open Tree. TreeFake *treetest.Fake // BQFake is a fake BQ client. BQFake *bq.Fake // TQDispatcher is a dispatcher with which task classes must be registered. // // Must not be set. TQDispatcher *tq.Dispatcher // TQ allows to run TQ tasks. TQ *tqtesting.Scheduler // Clock allows to move time forward. // By default, the time is moved automatically is something waits on it. Clock testclock.TestClock // MaxDuration limits how long a test can run as a fail safe. // // Defaults to 10s to most likely finish in pre/post submit tests, // with limited CPU resources. // Set to ~10ms when debugging a hung test. MaxDuration time.Duration // AppID overrides default AppID for in-memory tests. AppID string // contains filtered or unexported fields }
Test encapsulates typical setup for CV test.
Typical use:
ct := cvtesting.Test{} ctx, cancel := ct.SetUp() defer cancel()
func (*Test) RoundTestClock ¶
Directories ¶
Path | Synopsis |
---|---|
Package benchmarks contains benchmarks for heavy CV use cases.
|
Package benchmarks contains benchmarks for heavy CV use cases. |
Package e2e contains all CV end-to-end tests.
|
Package e2e contains all CV end-to-end tests. |
Click to show internal directories.
Click to hide internal directories.