Documentation ¶
Index ¶
- type TestController
- func (c *TestController) AddTimer(ctx context.Context, delay time.Duration, name string, payload []byte)
- func (c *TestController) DebugLog(format string, args ...any)
- func (c *TestController) EmitTrigger(ctx context.Context, trigger *internal.Trigger)
- func (c *TestController) GetClient(ctx context.Context, opts ...auth.RPCOption) (*http.Client, error)
- func (c *TestController) InvocationID() int64
- func (c *TestController) JobID() string
- func (c *TestController) PrepareTopic(ctx context.Context, publisher string) (topic string, token string, err error)
- func (c *TestController) RealmID() string
- func (c *TestController) Request() task.Request
- func (c *TestController) Save(ctx context.Context) error
- func (c *TestController) State() *task.State
- func (c *TestController) Task() proto.Message
- type TimerSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestController ¶
type TestController struct { OverrideJobID string // return value of JobID() if not "" OverrideInvID int64 // return value of InvocationID() if not 0 OverrideRealmID string // return value of RealmID if not "" 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 ¶
func (c *TestController) AddTimer(ctx context.Context, delay time.Duration, name string, payload []byte)
AddTimer is part of Controller interface.
func (*TestController) DebugLog ¶
func (c *TestController) DebugLog(format string, args ...any)
DebugLog is part of Controller interface.
func (*TestController) EmitTrigger ¶
func (c *TestController) EmitTrigger(ctx context.Context, trigger *internal.Trigger)
func (*TestController) GetClient ¶
func (c *TestController) GetClient(ctx context.Context, opts ...auth.RPCOption) (*http.Client, error)
GetClient is part of Controller interface.
func (*TestController) InvocationID ¶
func (c *TestController) InvocationID() int64
InvocationID is part of Controller interface.
func (*TestController) JobID ¶
func (c *TestController) JobID() string
JobID is part of Controller interface.
func (*TestController) PrepareTopic ¶
func (c *TestController) PrepareTopic(ctx context.Context, publisher string) (topic string, token string, err error)
PrepareTopic is part of Controller interface.
func (*TestController) RealmID ¶
func (c *TestController) RealmID() string
RealmID is part of Controller interface.
func (*TestController) Request ¶
func (c *TestController) Request() task.Request
Request is part of Controller interface.
func (*TestController) Save ¶
func (c *TestController) Save(ctx context.Context) error
Save is part of Controller interface.
func (*TestController) State ¶
func (c *TestController) State() *task.State
State is part of Controller interface.
func (*TestController) Task ¶
func (c *TestController) Task() proto.Message
Task is part of Controller interface.
Click to show internal directories.
Click to hide internal directories.