luci: go.chromium.org/luci/scheduler/appengine/task/utils/tasktest Index | Files

package tasktest

import "go.chromium.org/luci/scheduler/appengine/task/utils/tasktest"

Index

Package Files

controller.go

type TestController Uses

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 (*TestController) AddTimer Uses

func (c *TestController) AddTimer(ctx context.Context, delay time.Duration, name string, payload []byte)

AddTimer is part of Controller interface.

func (*TestController) DebugLog Uses

func (c *TestController) DebugLog(format string, args ...interface{})

DebugLog is part of Controller interface.

func (*TestController) EmitTrigger Uses

func (c *TestController) EmitTrigger(ctx context.Context, trigger *internal.Trigger)

func (*TestController) GetClient Uses

func (c *TestController) GetClient(ctx context.Context, opts ...auth.RPCOption) (*http.Client, error)

GetClient is part of Controller interface.

func (*TestController) InvocationID Uses

func (c *TestController) InvocationID() int64

InvocationID is part of Controller interface.

func (*TestController) JobID Uses

func (c *TestController) JobID() string

JobID is part of Controller interface.

func (*TestController) PrepareTopic Uses

func (c *TestController) PrepareTopic(ctx context.Context, publisher string) (topic string, token string, err error)

PrepareTopic is part of Controller interface.

func (*TestController) Request Uses

func (c *TestController) Request() task.Request

Request is part of Controller interface.

func (*TestController) Save Uses

func (c *TestController) Save(ctx context.Context) error

Save is part of Controller interface.

func (*TestController) State Uses

func (c *TestController) State() *task.State

State is part of Controller interface.

func (*TestController) Task Uses

func (c *TestController) Task() proto.Message

Task is part of Controller interface.

type TimerSpec Uses

type TimerSpec struct {
    Delay   time.Duration
    Name    string
    Payload []byte
}

TimerSpec corresponds to single AddTimer call.

Package tasktest imports 9 packages (graph). Updated 2018-12-14. Refresh now. Tools for package owners.