testing

package
Version: v0.0.0-...-8e6450d Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StubWorkflow      = "stub"
	ShortStubWorkflow = "stub"
	StubVersion       = "1"
)

Variables

View Source
var (
	StubTaskList      = &swf.TaskList{Name: S(fmt.Sprintf("%s->%s", StubWorkflow, StubVersion))}
	ShortStubTaskList = &swf.TaskList{Name: S(fmt.Sprintf("%s->%s", ShortStubWorkflow, StubVersion))}
)

Functions

func NoOpActivityInterceptor

func NoOpActivityInterceptor() activity.ActivityInterceptor

func ShortStubFSM

func ShortStubFSM(domain string, client fsm.SWFOps) *fsm.FSM

func ShortStubState

func ShortStubState() fsm.Decider

func StubFSM

func StubFSM(domain string, client fsm.SWFOps) *fsm.FSM

func StubState

func StubState() fsm.Decider

func TestDecisionInterceptor

func TestDecisionInterceptor(testId string, stubbedWorkflows, stubbedShortWorkflows []string) fsm.DecisionInterceptor

intercept any attempts to start a workflow and launch the stub workflow instead.

func TestFailOnceActivityInterceptor

func TestFailOnceActivityInterceptor() activity.ActivityInterceptor

interceptor that fails the activity once per activity and returns to actual result subsequent time used to test error handling and retries of activities in fsms

func TestReplicator

func TestReplicator(decisionOutcomes chan DecisionOutcome) fsm.ReplicationHandler

func TestSWF

func TestSWF(client fsm.ClientSWFOps, stubbedWorkflow ...string) fsm.ClientSWFOps

func TestThrotteCancelsOnceInterceptor

func TestThrotteCancelsOnceInterceptor() fsm.DecisionInterceptor

func TestThrotteChildrenOnceInterceptor

func TestThrotteChildrenOnceInterceptor() fsm.DecisionInterceptor

func TestThrotteSignalsOnceInterceptor

func TestThrotteSignalsOnceInterceptor() fsm.DecisionInterceptor

func TestThrotteTimersOnceInterceptor

func TestThrotteTimersOnceInterceptor(numTimers int) fsm.DecisionInterceptor

This one is a bit weird. OnStart, we need to schedule a bunch of timers that we can use to cause timer id in use failures, that we rewrite to throttles

Types

type DecisionOutcome

type DecisionOutcome struct {
	DecisionTask *swf.PollForDecisionTaskOutput
	State        *fsm.SerializedState
	Decisions    []*swf.Decision
}

type NoData

type NoData struct{}

type StateData

type StateData struct {
	State string
	Data  interface{}
}

type StubSWFClient

type StubSWFClient struct {
	fsm.ClientSWFOps
	// contains filtered or unexported fields
}

intercept any attempts to start a workflow and launch the stub workflow instead.

func (*StubSWFClient) StartWorkflowExecution

func (s *StubSWFClient) StartWorkflowExecution(req *swf.StartWorkflowExecutionInput) (resp *swf.StartWorkflowExecutionOutput, err error)

type TestAdapter

type TestAdapter interface {
	TestName() string
	Logf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	FailNow()
}

type TestConfig

type TestConfig struct {
	Testing               TestAdapter
	FSM                   *fsm.FSM
	StubFSM               *fsm.FSM
	Workers               []*activity.ActivityWorker
	StubbedWorkflows      []string
	ShortStubbedWorkflows []string
	DefaultWaitTimeout    int
	FailActivitiesOnce    bool
	ThrottleSignalsOnce   bool
	ThrottleCancelsOnce   bool
	ThrottleChildrenOnce  bool
	ThrottleTimersOnce    bool
}

type TestListener

type TestListener struct {
	DefaultWait time.Duration

	TestId string
	// contains filtered or unexported fields
}

func NewTestListener

func NewTestListener(t TestConfig) *TestListener

func (*TestListener) AwaitData

func (tl *TestListener) AwaitData(workflowId string, predicate func(*StateData) bool)

func (*TestListener) AwaitDataFor

func (tl *TestListener) AwaitDataFor(workflowId string, waitFor time.Duration, predicate func(*StateData) bool)

func (*TestListener) AwaitDecision

func (tl *TestListener) AwaitDecision(workflowId string, predicate func(*swf.Decision) bool)

func (*TestListener) AwaitDecisionFor

func (tl *TestListener) AwaitDecisionFor(workflowId string, waitFor time.Duration, predicate func(*swf.Decision) bool)

func (*TestListener) AwaitEvent

func (tl *TestListener) AwaitEvent(workflowId string, predicate func(*swf.HistoryEvent) bool)

func (*TestListener) AwaitEventFor

func (tl *TestListener) AwaitEventFor(workflowId string, waitFor time.Duration, predicate func(*swf.HistoryEvent) bool)

func (*TestListener) AwaitState

func (tl *TestListener) AwaitState(workflowId, state string)

func (*TestListener) AwaitStateFor

func (tl *TestListener) AwaitStateFor(workflowId, state string, waitFor time.Duration)

func (*TestListener) RegisterDataInterest

func (tl *TestListener) RegisterDataInterest(workflowId string)

func (*TestListener) RegisterDecisionInterest

func (tl *TestListener) RegisterDecisionInterest(workflowId string)

func (*TestListener) RegisterHistoryInterest

func (tl *TestListener) RegisterHistoryInterest(workflowId string)

func (*TestListener) RegisterStateInterest

func (tl *TestListener) RegisterStateInterest(workflowId string)

func (*TestListener) Start

func (tl *TestListener) Start()

func (*TestListener) Stop

func (tl *TestListener) Stop()

func (*TestListener) TestFsmTaskList

func (tl *TestListener) TestFsmTaskList() string

func (*TestListener) TestWorkerTaskList

func (tl *TestListener) TestWorkerTaskList(w *activity.ActivityWorker) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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