cqdfake

package
v0.0.0-...-51f9457 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package cqdfake implements fake CQDaemon for use in tests.

The package is meant to be deleted after migration to CV is over. TODO(cbrug/1141880): delete this package.

Index

Constants

View Source
const StartingMessage = "CQ is trying da patch"

StartingMessage is what CQDaemon fake posts when starting working on a Run.

Yes, spelling is right -- this is what CQDaemon posted historically.

Variables

This section is empty.

Functions

This section is empty.

Types

type CQDFake

type CQDFake struct {
	LUCIProject string
	CV          migrationpb.MigrationServer
	GFake       *gf.Fake
	// contains filtered or unexported fields
}

func (*CQDFake) ActiveAttemptKeys

func (cqd *CQDFake) ActiveAttemptKeys() []string

Returns sorted slice of attempt keys.

func (*CQDFake) Close

func (cqd *CQDFake) Close()

Close stops CQDaemon fake and waits for it to complete.

func (*CQDFake) SetCandidatesClbk

func (cqd *CQDFake) SetCandidatesClbk(clbk CandidatesClbk)

SetCandidatesClbk (re)sets callback func called per CQDaemon loop if CQDaemon is in charge.

Set it to mock what would-be candidates if Gerrit was queried directly. NOTE: the FetchExcludedCLs will still be applied on the output of the callback.

func (*CQDFake) SetShouldCrashClbk

func (cqd *CQDFake) SetShouldCrashClbk(clbk ShouldCrashClbk)

SetShouldCrashClbk (re)sets callback func.

func (*CQDFake) SetVerifyClbk

func (cqd *CQDFake) SetVerifyClbk(clbk VerifyClbk)

SetVerifyClbk (re)sets callback func called per CQDaemon active attempt once per loop.

func (*CQDFake) Start

func (cqd *CQDFake) Start(ctx context.Context)

Start starts CQDFake in background until the given context is cancelled or Close() is called.

type CandidatesClbk

type CandidatesClbk func() []*migrationpb.ReportedRun

CandidatesClbk is called if CQDaemon is in charge to get Runs to work on.

NOTE: the FetchExcludedCLs will still be applied on the output of the callback.

type Operation

type Operation string
const (
	OpReportFinishedRun Operation = "OpReportFinishedRun"
)

type ShouldCrashClbk

type ShouldCrashClbk func(nextOp Operation, key string) bool

ShouldCrashClbk is consulted to decide if CQD should crash.

key is attempt key if operation is specific to an Attempt.

type VerifyClbk

type VerifyClbk func(r *migrationpb.ReportedRun) *migrationpb.ReportedRun

VerifyClbk called once per CL per CQDaemon iteration.

May modify the CL via copy-on-write and return the new value.

Jump to

Keyboard shortcuts

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