import "go.chromium.org/luci/scheduler/appengine/task/utils/tasktest"
type TestController struct { OverrideJobID string // return value of JobID() if not "" OverrideInvID int64 // return value of InvocationID() if not 0 Req task.Request // return value of Request TaskMessage proto.Message // return value of Task TaskState task.State // return value of State(), mutated in place Client *http.Client // return value by GetClient() Log []string // individual log lines passed to DebugLog() SaveCallback func() error // mock for Save() PrepareTopicCallback func(string) (string, string, error) // mock for PrepareTopic() Timers []TimerSpec Triggers []*internal.Trigger }
TestController implements task.Controller and can be used in unit tests.
func (c *TestController) AddTimer(ctx context.Context, delay time.Duration, name string, payload []byte)
AddTimer is part of Controller interface.
func (c *TestController) DebugLog(format string, args ...interface{})
DebugLog is part of Controller interface.
func (c *TestController) GetClient(ctx context.Context, opts ...auth.RPCOption) (*http.Client, error)
GetClient is part of Controller interface.
func (c *TestController) InvocationID() int64
InvocationID is part of Controller interface.
func (c *TestController) JobID() string
JobID is part of Controller interface.
func (c *TestController) PrepareTopic(ctx context.Context, publisher string) (topic string, token string, err error)
PrepareTopic is part of Controller interface.
func (c *TestController) Request() task.Request
Request is part of Controller interface.
func (c *TestController) Save(ctx context.Context) error
Save is part of Controller interface.
func (c *TestController) State() *task.State
State is part of Controller interface.
func (c *TestController) Task() proto.Message
Task is part of Controller interface.
TimerSpec corresponds to single AddTimer call.
Package tasktest imports 9 packages (graph). Updated 2021-01-24. Refresh now. Tools for package owners.