pmtest

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package pmtest implements tests for working with Project Manager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertInEventbox

func AssertInEventbox(t testing.TB, ctx context.Context, project string, targets ...*prjpb.Event)

AssertInEventbox asserts all events exist in the project Eventbox.

func AssertNotInEventbox

func AssertNotInEventbox(t testing.TB, ctx context.Context, project string, targets ...*prjpb.Event)

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

func AssertReceivedCLsNotified

func AssertReceivedCLsNotified(t testing.TB, ctx context.Context, project string, cls []*changelist.CL)

AssertCLsUpdated asserts all events exist in the project Eventbox.

func AssertReceivedRunFinished

func AssertReceivedRunFinished(t testing.TB, ctx context.Context, runID common.RunID, status run.Status)

AssertReceivedRunFinished asserts a RunFinished event has been delivered tor project's eventbox for the given Run.

func ETAsOF

func ETAsOF(in tqtesting.TaskList, luciProject string) []time.Time

ETAsOf returns sorted list of ETAs for a given project.

Includes ETAs encoded in KickManageProjectTask tasks.

func ETAsWithin

func ETAsWithin(in tqtesting.TaskList, luciProject string, d time.Duration, t time.Time) []time.Time

ETAsWithin returns sorted list of ETAs for a given project in t+-d range.

func LatestETAof

func LatestETAof(in tqtesting.TaskList, luciProject string) time.Time

LatestETAof returns time.Time of the latest task for a given project.

Includes ETAs encoded in KickManageProjectTask tasks. If none, returns Zero time.Time{}.

func Projects

func Projects(in tqtesting.TaskList) (projects []string)

Projects returns list of projects from tasks for PM.

func PurgingCLs

func PurgingCLs(in tqtesting.TaskList, luciProject string) []int64

PurgingCLs returns IDs of CLs are scheduled to be purged for the project.

Returns IDs as int64s for ease of comparison.

Types

type MockDispatcher

type MockDispatcher struct {
	*cvtesting.DispatchRecorder
}

MockDispatcher records in memory what would have resulted in task enqueues for a PM.

func MockDispatch

func MockDispatch(ctx context.Context) (context.Context, MockDispatcher)

MockDispatch installs and returns MockDispatcher for PM.

func (*MockDispatcher) PopProjects

func (m *MockDispatcher) PopProjects() []string

PopProjects returns sorted list of Projects and resets the state.

func (*MockDispatcher) Projects

func (m *MockDispatcher) Projects() []string

Projects returns sorted list of Projects.

Jump to

Keyboard shortcuts

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