Documentation ¶
Overview ¶
Package runtest implements tests for working with Run Manager.
Index ¶
- func AreEnded(runs ...*run.Run) bool
- func AreRunning(runs ...*run.Run) bool
- func AssertEventboxEmpty(t testing.TB, ctx context.Context, runID common.RunID)
- func AssertInEventbox(t testing.TB, ctx context.Context, runID common.RunID, ...)
- func AssertNotInEventbox(t testing.TB, ctx context.Context, runID common.RunID, ...)
- func AssertNotReceivedCLsSubmitted(t testing.TB, ctx context.Context, runID common.RunID, clids ...common.CLID)
- func AssertNotReceivedParentRunCompleted(t testing.TB, ctx context.Context, runID common.RunID)
- func AssertReceivedCLsSubmitted(t testing.TB, ctx context.Context, runID common.RunID, clids ...common.CLID)
- func AssertReceivedLongOpCompleted(t testing.TB, ctx context.Context, runID common.RunID, ...)
- func AssertReceivedParentRunCompleted(t testing.TB, ctx context.Context, runID common.RunID)
- func AssertReceivedPoke(t testing.TB, ctx context.Context, runID common.RunID, eta time.Time)
- func AssertReceivedReadyForSubmission(t testing.TB, ctx context.Context, runID common.RunID, eta time.Time)
- func AssertReceivedStart(t testing.TB, ctx context.Context, runID common.RunID)
- func AssertReceivedSubmissionCompleted(t testing.TB, ctx context.Context, runID common.RunID, ...)
- func FilterNot(status run.Status, runs ...*run.Run) []*run.Run
- func Runs(in tqtesting.TaskList) (runs common.RunIDs)
- func SortedRuns(in tqtesting.TaskList) common.RunIDs
- func Tasks(in tqtesting.TaskList) tqtesting.TaskList
- type MockDispatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreRunning ¶
AreRunning is true if all runs are non-nil and Running.
func AssertEventboxEmpty ¶
AssertEventboxEmpty asserts the eventbox of the provided Run is empty.
func AssertInEventbox ¶
func AssertInEventbox(t testing.TB, ctx context.Context, runID common.RunID, targets ...*eventpb.Event)
AssertInEventbox asserts all target events exist in the Eventbox.
func AssertNotInEventbox ¶
func AssertNotInEventbox(t testing.TB, ctx context.Context, runID common.RunID, targets ...*eventpb.Event)
AssertNotInEventbox asserts none of the target events exists in the Eventbox.
func AssertNotReceivedCLsSubmitted ¶
func AssertNotReceivedCLsSubmitted(t testing.TB, ctx context.Context, runID common.RunID, clids ...common.CLID)
AssertNotReceivedCLsSubmitted asserts Run has NOT received CLsSubmitted event for the provided CL.
func AssertNotReceivedParentRunCompleted ¶
AssertNotReceivedParentRunCompleted asserts Run has not received ParentRunCompleted event.
func AssertReceivedCLsSubmitted ¶
func AssertReceivedCLsSubmitted(t testing.TB, ctx context.Context, runID common.RunID, clids ...common.CLID)
AssertReceivedCLsSubmitted asserts Run has received CLsSubmitted event for the provided CL.
func AssertReceivedLongOpCompleted ¶
func AssertReceivedLongOpCompleted(t testing.TB, ctx context.Context, runID common.RunID, result *eventpb.LongOpCompleted)
AssertReceivedLongOpCompleted asserts Run has received LongOpCompleted event.
func AssertReceivedParentRunCompleted ¶
AssertReceivedParentRunCompleted asserts Run has received ParentRunCompleted event.
func AssertReceivedPoke ¶
AssertReceivedPoke asserts Run has received Poke event that should be processed at `eta`.
If `eta` is not later than now, assert that Poke event should be processed immediately.
func AssertReceivedReadyForSubmission ¶
func AssertReceivedReadyForSubmission(t testing.TB, ctx context.Context, runID common.RunID, eta time.Time)
AssertReceivedReadyForSubmission asserts Run has received ReadyForSubmission event.
func AssertReceivedStart ¶
AssertReceivedStart asserts Run has received Start event.
func AssertReceivedSubmissionCompleted ¶
func AssertReceivedSubmissionCompleted(t testing.TB, ctx context.Context, runID common.RunID, sc *eventpb.SubmissionCompleted)
AssertReceivedSubmissionCompleted asserts Run has received the provided SubmissionCompleted event.
func FilterNot ¶
FilterNot returns non-nil Runs whose status differs from the given one.
If given ENDED_MASK status, returns all Runs which haven't ended yet.
func SortedRuns ¶
SortedRuns returns sorted list of runs from tasks for Run Manager.
Types ¶
type MockDispatcher ¶
type MockDispatcher struct {
*cvtesting.DispatchRecorder
}
MockDispatcher records in memory what would have resulted in task enqueues for a Run Manager.
func MockDispatch ¶
func MockDispatch(ctx context.Context) (context.Context, MockDispatcher)
MockDispatch installs and returns MockDispatcher for Run Manager.
func (*MockDispatcher) PopRuns ¶
func (m *MockDispatcher) PopRuns() common.RunIDs
PopRuns returns sorted list of Run IDs and resets the state.
func (*MockDispatcher) Runs ¶
func (m *MockDispatcher) Runs() common.RunIDs
Runs returns sorted list of Run IDs.