Documentation
¶
Index ¶
- func BaseDir(repoDir string, lang clioptions.Language) string
- func LogHistoryEvents(t *testing.T, events []*historypb.HistoryEvent)
- func NewWorkerPool(env *TestEnvironment) *workerPool
- type Builder
- type FullHistoryMatcher
- type HistoryMatcher
- type PartialHistoryMatcher
- type Runner
- type TestEnvOption
- type TestEnvironment
- func (env *TestEnvironment) DevServerAddress() string
- func (env *TestEnvironment) NexusEndpointName() string
- func (env *TestEnvironment) RunExecutorTest(t *testing.T, executor loadgen.Executor, scenarioInfo loadgen.ScenarioInfo, ...) (TestResult, error)
- func (env *TestEnvironment) TemporalClient() client.Client
- type TestResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogHistoryEvents ¶
func LogHistoryEvents(t *testing.T, events []*historypb.HistoryEvent)
func NewWorkerPool ¶
func NewWorkerPool(env *TestEnvironment) *workerPool
Types ¶
type Builder ¶
type Builder struct {
DirName string
SdkOptions clioptions.SdkOptions
Logger *zap.SugaredLogger
// contains filtered or unexported fields
}
type FullHistoryMatcher ¶
type FullHistoryMatcher string
FullHistoryMatcher checks that the list of history events match the expected spec. The expected spec is a string with each line containing an (1) event type, (2) optional JSON literal matching the event attributes and (3) an optional comment.
Example:
WorkflowExecutionStarted {"taskQueue":"foo-bar"}
WorkflowTaskScheduled
WorkflowTaskStarted
WorkflowTaskCompleted
TimerStarted {"startToFireTimeout":"1s"} # TimerStarted event with a 1s timeout
TimerFired
WorkflowTaskScheduled
WorkflowTaskStarted
WorkflowTaskCompleted
WorkflowExecutionCompleted
func (FullHistoryMatcher) Match ¶
func (m FullHistoryMatcher) Match(t *testing.T, actualHistoryEvents []*historypb.HistoryEvent) error
type HistoryMatcher ¶
type HistoryMatcher interface {
Match(t *testing.T, actualHistoryEvents []*historypb.HistoryEvent) error
}
HistoryMatcher defines the interface for history matching strategies
type PartialHistoryMatcher ¶
type PartialHistoryMatcher string
PartialHistoryMatcher checks that the list of history events contains a subsequence that matches the expected spec. The expected spec is a string with each line containing an (1) event type, (2) optional JSON literal matching the event attributes and (3) an optional comment. Use "..." as an event type to skip any number of events.
Example:
WorkflowExecutionStarted {"taskQueue":"foo-bar"}
...
WorkflowExecutionCompleted
func (PartialHistoryMatcher) Match ¶
func (m PartialHistoryMatcher) Match(t *testing.T, actualHistoryEvents []*historypb.HistoryEvent) error
type Runner ¶
type Runner struct {
Builder
RetainTempDir bool
GracefulShutdownDuration time.Duration
EmbeddedServer bool
EmbeddedServerAddress string
TaskQueueName string
TaskQueueIndexSuffixStart int
TaskQueueIndexSuffixEnd int
ScenarioID clioptions.ScenarioID
ClientOptions clioptions.ClientOptions
MetricsOptions clioptions.MetricsOptions
WorkerOptions clioptions.WorkerOptions
LoggingOptions clioptions.LoggingOptions
OnWorkerStarted func()
}
type TestEnvOption ¶
type TestEnvOption func(*testEnvConfig)
func WithExecutorTimeout ¶
func WithExecutorTimeout(d time.Duration) TestEnvOption
WithExecutorTimeout sets a custom timeout for the executor run context.
func WithNexusEndpoint ¶
func WithNexusEndpoint(taskQueue string) TestEnvOption
WithNexusEndpoint instructs the test environment to create a Nexus endpoint.
type TestEnvironment ¶
type TestEnvironment struct {
// contains filtered or unexported fields
}
func SetupTestEnvironment ¶
func SetupTestEnvironment(t *testing.T, opts ...TestEnvOption) *TestEnvironment
func (*TestEnvironment) DevServerAddress ¶
func (env *TestEnvironment) DevServerAddress() string
func (*TestEnvironment) NexusEndpointName ¶
func (env *TestEnvironment) NexusEndpointName() string
func (*TestEnvironment) RunExecutorTest ¶
func (env *TestEnvironment) RunExecutorTest( t *testing.T, executor loadgen.Executor, scenarioInfo loadgen.ScenarioInfo, sdk clioptions.Language, ) (TestResult, error)
RunExecutorTest runs an executor with a specific SDK and server address
func (*TestEnvironment) TemporalClient ¶
func (env *TestEnvironment) TemporalClient() client.Client
type TestResult ¶
type TestResult struct {
ObservedLogs *observer.ObservedLogs
}