workers

package
v0.0.0-...-e33cdd0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseDir

func BaseDir(repoDir string, lang clioptions.Language) string

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
}

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, baseDir string) (sdkbuild.Program, error)

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()
}

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, baseDir string) error

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
}

Directories

Path Synopsis
go module

Jump to

Keyboard shortcuts

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