Documentation
¶
Overview ¶
Package operatortest holds a sample contract operator for tests. Echo is written against pkg/operator only, so the same handler is opened through the in-process host in unit tests and through the gRPC host in the operator end-to-end suite; that both work is the rule the contract exists for.
Index ¶
- type Echo
- type Session
- func (s *Session) AddActions(_ context.Context, ids []string) error
- func (s *Session) Added() [][]string
- func (s *Session) Close(context.Context) error
- func (s *Session) Closed() bool
- func (s *Session) Done() <-chan struct{}
- func (s *Session) Err() error
- func (s *Session) Events() []*contracts.StepActionEvent
- func (s *Session) Flush(context.Context) error
- func (s *Session) Flushes() int
- func (s *Session) OpenDurable(context.Context, uuid.UUID, int32) (operator.DurableChannel, error)
- func (s *Session) Ops() []string
- func (s *Session) Pause(context.Context) error
- func (s *Session) PutWorkflow(context.Context, *v1.CreateWorkflowVersionRequest) ([]string, error)
- func (s *Session) Registration() operator.Registration
- func (s *Session) RemoveActions(_ context.Context, ids []string) error
- func (s *Session) Removed() [][]string
- func (s *Session) SendStepActionEvent(_ context.Context, ev *contracts.StepActionEvent) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Echo ¶
type Echo struct {
// contains filtered or unexported fields
}
Echo completes every START_STEP_RUN it is handed with the task's input as its output. It reports STARTED at once and COMPLETED from a goroutine, the way an operator whose work takes time would, and tracks the goroutines so Drain can wait for them.
func (*Echo) Drain ¶
Drain implements operator.Operator: it waits for every report in flight, or for ctx.
func (*Echo) HandleAction ¶
HandleAction implements operator.ActionHandler.
type Session ¶
type Session struct {
// PauseErr, when set, fails Pause.
PauseErr error
// contains filtered or unexported fields
}
Session is a recording operator.Session for tests of operators and hosts' callers: events, deltas, flushes, pauses and the close are recorded in order; durable channels and workflows are not supported.
func NewSession ¶
NewSession builds a session registered for the given tenant, operator and a fresh worker.
func (*Session) Done ¶
func (s *Session) Done() <-chan struct{}
Done implements operator.Session; it closes with Close.
func (*Session) Err ¶
Err implements operator.Session; the recording session never gives up on its own.
func (*Session) Events ¶
func (s *Session) Events() []*contracts.StepActionEvent
Events returns the step action events reported so far, in order.
func (*Session) OpenDurable ¶
func (*Session) PutWorkflow ¶
func (*Session) Registration ¶
func (s *Session) Registration() operator.Registration