runtest

package
v0.0.0-...-ef45db5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package runtest implements tests for working with Run Manager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreEnded

func AreEnded(runs ...*run.Run) bool

AreEnded is true if all runs are not nil and have ended.

func AreRunning

func AreRunning(runs ...*run.Run) bool

AreRunning is true if all runs are non-nil and Running.

func AssertEventboxEmpty

func AssertEventboxEmpty(ctx context.Context, runID common.RunID)

AssertEventboxEmpty asserts the eventbox of the provided Run is empty.

func AssertInEventbox

func AssertInEventbox(ctx context.Context, runID common.RunID, targets ...*eventpb.Event)

AssertInEventbox asserts all target events exist in the Eventbox.

func AssertNotInEventbox

func AssertNotInEventbox(ctx context.Context, runID common.RunID, targets ...*eventpb.Event)

AssertNotInEventbox asserts none of the target events exists in the Eventbox.

func AssertNotReceivedCLsSubmitted

func AssertNotReceivedCLsSubmitted(ctx context.Context, runID common.RunID, clids ...common.CLID)

AssertNotReceivedCLsSubmitted asserts Run has NOT received CLsSubmitted event for the provided CL.

func AssertNotReceivedParentRunCompleted

func AssertNotReceivedParentRunCompleted(ctx context.Context, runID common.RunID)

AssertNotReceivedParentRunCompleted asserts Run has not received ParentRunCompleted event.

func AssertReceivedCLsSubmitted

func AssertReceivedCLsSubmitted(ctx context.Context, runID common.RunID, clids ...common.CLID)

AssertReceivedCLsSubmitted asserts Run has received CLsSubmitted event for the provided CL.

func AssertReceivedLongOpCompleted

func AssertReceivedLongOpCompleted(ctx context.Context, runID common.RunID, result *eventpb.LongOpCompleted)

AssertReceivedLongOpCompleted asserts Run has received LongOpCompleted event.

func AssertReceivedParentRunCompleted

func AssertReceivedParentRunCompleted(ctx context.Context, runID common.RunID)

AssertReceivedParentRunCompleted asserts Run has received ParentRunCompleted event.

func AssertReceivedPoke

func AssertReceivedPoke(ctx context.Context, runID common.RunID, eta time.Time)

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(ctx context.Context, runID common.RunID, eta time.Time)

AssertReceivedReadyForSubmission asserts Run has received ReadyForSubmission event.

func AssertReceivedStart

func AssertReceivedStart(ctx context.Context, runID common.RunID)

AssertReceivedStart asserts Run has received Start event.

func AssertReceivedSubmissionCompleted

func AssertReceivedSubmissionCompleted(ctx context.Context, runID common.RunID, sc *eventpb.SubmissionCompleted)

AssertReceivedSubmissionCompleted asserts Run has received the provided SubmissionCompleted event.

func FilterNot

func FilterNot(status run.Status, runs ...*run.Run) []*run.Run

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 Runs

func Runs(in tqtesting.TaskList) (runs common.RunIDs)

Runs returns list of runs from tasks for Run Manager.

func ShouldResembleRun

func ShouldResembleRun(actual any, expected ...any) string

ShouldResembleRun compares 2 Runs.

Deprecated. Use cvtesting.SafeShouldResemble directly.

func SortedRuns

func SortedRuns(in tqtesting.TaskList) common.RunIDs

SortedRuns returns sorted list of runs from tasks for Run Manager.

func Tasks

Tasks returns all Run tasks sorted by ETA.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL