temporal_tester

package
v0.327.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptyClientsBuilder

func EmptyClientsBuilder(context.Context, string, *client.Options) (client.Client, error)

func MockClientsBuilder

func MockClientsBuilder(mocks ...MockedWorker) func(context.Context, string, *client.Options) (client.Client, error)

func MockWorkerBuilder

func MockWorkerBuilder(client client.Client, taskQueue string, options worker.Options) worker.Worker

func NewEnvWithWorkflows

func NewEnvWithWorkflows(wfs ...MockWorkflow) *testsuite.TestWorkflowEnvironment

func NewTemporalMockClient

func NewTemporalMockClient(env *testsuite.TestWorkflowEnvironment) client.Client

func PatchedService

func PatchedService[
	AppConfig, ServiceInterface any,
](
	t syslgo.TestingT,
	createService core.ServiceDefinition[AppConfig, ServiceInterface],
	testHooks *core.Hooks,
	withActualDownstreams bool,
) func(context.Context, AppConfig) (ServiceInterface, *core.Hooks, error)

TODO: use this on other test services.

Types

type MockBase

type MockBase[Resp any] struct {
	// contains filtered or unexported fields
}

func NewMockWorkflowBase

func NewMockWorkflowBase[Resp any](t syslgo.TestingT) *MockBase[Resp]

func (*MockBase[Resp]) BuildMockActivity

func (m *MockBase[Resp]) BuildMockActivity() func(context.Context, ...any) (Resp, error)

func (*MockBase[Resp]) BuildMockActivityWithoutReturn

func (m *MockBase[Resp]) BuildMockActivityWithoutReturn() func(context.Context, ...any) error

func (*MockBase[Resp]) BuildMockWorkflow

func (m *MockBase[Resp]) BuildMockWorkflow() func(workflow.Context, ...any) (Resp, error)

func (*MockBase[Resp]) BuildMockWorkflowWithoutReturn

func (m *MockBase[Resp]) BuildMockWorkflowWithoutReturn() func(workflow.Context, ...any) error

func (*MockBase[Resp]) CheckExpectations

func (m *MockBase[Resp]) CheckExpectations(actual ...any)

func (*MockBase[Resp]) ExpectOptions

func (m *MockBase[Resp]) ExpectOptions(opt client.StartWorkflowOptions)

func (*MockBase[Resp]) ExpectRequest

func (m *MockBase[Resp]) ExpectRequest(req ...any)

func (*MockBase[Resp]) IsMocked

func (m *MockBase[Resp]) IsMocked() bool

func (*MockBase[Resp]) MockErrorOnlyResponse

func (m *MockBase[Resp]) MockErrorOnlyResponse(err error)

func (*MockBase[Resp]) MockResponse

func (m *MockBase[Resp]) MockResponse(resp Resp, err error)

type MockClient

type MockClient struct {
	Env *testsuite.TestWorkflowEnvironment
}

func (*MockClient) CancelWorkflow

func (m *MockClient) CancelWorkflow(ctx context.Context, workflowID string, runID string) error

func (*MockClient) CheckHealth

func (*MockClient) Close

func (m *MockClient) Close()

func (*MockClient) CompleteActivity

func (m *MockClient) CompleteActivity(ctx context.Context, taskToken []byte, result interface{}, err error) error

func (*MockClient) CompleteActivityByID

func (m *MockClient) CompleteActivityByID(ctx context.Context, namespace, workflowID, runID, activityID string, result interface{}, err error) error

func (*MockClient) CountWorkflow

func (m *MockClient) CountWorkflow(ctx context.Context, request *workflowservice.CountWorkflowExecutionsRequest) (*workflowservice.CountWorkflowExecutionsResponse, error)

func (*MockClient) DescribeTaskQueue

func (m *MockClient) DescribeTaskQueue(ctx context.Context, taskqueue string, taskqueueType enumspb.TaskQueueType) (*workflowservice.DescribeTaskQueueResponse, error)

func (*MockClient) DescribeTaskQueueEnhanced added in v0.326.0

func (m *MockClient) DescribeTaskQueueEnhanced(ctx context.Context, options client.DescribeTaskQueueEnhancedOptions) (client.TaskQueueDescription, error)

func (*MockClient) DescribeWorkflowExecution

func (m *MockClient) DescribeWorkflowExecution(ctx context.Context, workflowID, runID string) (*workflowservice.DescribeWorkflowExecutionResponse, error)

func (*MockClient) ExecuteWorkflow

func (m *MockClient) ExecuteWorkflow(
	ctx context.Context,
	options client.StartWorkflowOptions,
	workflow interface{},
	args ...interface{},
) (client.WorkflowRun, error)

func (*MockClient) GetEnv

func (*MockClient) GetSearchAttributes

func (m *MockClient) GetSearchAttributes(ctx context.Context) (*workflowservice.GetSearchAttributesResponse, error)

func (*MockClient) GetWorkerBuildIdCompatibility added in v0.315.0

func (m *MockClient) GetWorkerBuildIdCompatibility(ctx context.Context, options *client.GetWorkerBuildIdCompatibilityOptions) (*client.WorkerBuildIDVersionSets, error)

func (*MockClient) GetWorkerTaskReachability added in v0.317.0

func (m *MockClient) GetWorkerTaskReachability(ctx context.Context, options *client.GetWorkerTaskReachabilityOptions) (*client.WorkerTaskReachability, error)

func (*MockClient) GetWorkerVersioningRules added in v0.326.0

func (m *MockClient) GetWorkerVersioningRules(ctx context.Context, options client.GetWorkerVersioningOptions) (*client.WorkerVersioningRules, error)

func (*MockClient) GetWorkflow

func (m *MockClient) GetWorkflow(ctx context.Context, workflowID string, runID string) client.WorkflowRun

func (*MockClient) GetWorkflowHistory

func (m *MockClient) GetWorkflowHistory(ctx context.Context, workflowID string, runID string, isLongPoll bool, filterType enumspb.HistoryEventFilterType) client.HistoryEventIterator

func (*MockClient) GetWorkflowUpdateHandle added in v0.315.0

func (*MockClient) ListArchivedWorkflow

func (m *MockClient) ListArchivedWorkflow(ctx context.Context, request *workflowservice.ListArchivedWorkflowExecutionsRequest) (*workflowservice.ListArchivedWorkflowExecutionsResponse, error)

func (*MockClient) ListClosedWorkflow

func (m *MockClient) ListClosedWorkflow(ctx context.Context, request *workflowservice.ListClosedWorkflowExecutionsRequest) (*workflowservice.ListClosedWorkflowExecutionsResponse, error)

func (*MockClient) ListOpenWorkflow

func (m *MockClient) ListOpenWorkflow(ctx context.Context, request *workflowservice.ListOpenWorkflowExecutionsRequest) (*workflowservice.ListOpenWorkflowExecutionsResponse, error)

func (*MockClient) ListWorkflow

func (m *MockClient) ListWorkflow(ctx context.Context, request *workflowservice.ListWorkflowExecutionsRequest) (*workflowservice.ListWorkflowExecutionsResponse, error)

func (*MockClient) OperatorService

func (m *MockClient) OperatorService() operatorservice.OperatorServiceClient

func (*MockClient) QueryWorkflow

func (m *MockClient) QueryWorkflow(ctx context.Context, workflowID string, runID string, queryType string, args ...interface{}) (converter.EncodedValue, error)

func (*MockClient) RecordActivityHeartbeat

func (m *MockClient) RecordActivityHeartbeat(ctx context.Context, taskToken []byte, details ...interface{}) error

func (*MockClient) RecordActivityHeartbeatByID

func (m *MockClient) RecordActivityHeartbeatByID(ctx context.Context, namespace, workflowID, runID, activityID string, details ...interface{}) error

func (*MockClient) ResetWorkflowExecution

func (m *MockClient) ResetWorkflowExecution(ctx context.Context, request *workflowservice.ResetWorkflowExecutionRequest) (*workflowservice.ResetWorkflowExecutionResponse, error)

func (*MockClient) ScanWorkflow

func (m *MockClient) ScanWorkflow(ctx context.Context, request *workflowservice.ScanWorkflowExecutionsRequest) (*workflowservice.ScanWorkflowExecutionsResponse, error)

func (*MockClient) ScheduleClient added in v0.298.0

func (m *MockClient) ScheduleClient() client.ScheduleClient

func (*MockClient) SignalWithStartWorkflow

func (m *MockClient) SignalWithStartWorkflow(ctx context.Context, workflowID string, signalName string, signalArg interface{}, options client.StartWorkflowOptions, workflow interface{}, workflowArgs ...interface{}) (client.WorkflowRun, error)

func (*MockClient) SignalWorkflow

func (m *MockClient) SignalWorkflow(
	ctx context.Context,
	workflowID string,
	runID string,
	signalName string,
	arg interface{},
) error

func (*MockClient) TerminateWorkflow

func (m *MockClient) TerminateWorkflow(ctx context.Context, workflowID string, runID string, reason string, details ...interface{}) error

func (*MockClient) UpdateWorkerBuildIdCompatibility added in v0.315.0

func (m *MockClient) UpdateWorkerBuildIdCompatibility(ctx context.Context, options *client.UpdateWorkerBuildIdCompatibilityOptions) error

func (*MockClient) UpdateWorkerVersioningRules added in v0.326.0

func (m *MockClient) UpdateWorkerVersioningRules(ctx context.Context, options client.UpdateWorkerVersioningRulesOptions) (*client.WorkerVersioningRules, error)

func (*MockClient) UpdateWorkflow added in v0.303.0

func (*MockClient) UpdateWorkflowWithOptions added in v0.303.0

func (m *MockClient) UpdateWorkflowWithOptions(
	ctx context.Context, request *client.UpdateWorkflowOptions,
) (client.WorkflowUpdateHandle, error)

func (*MockClient) WorkflowService

func (m *MockClient) WorkflowService() workflowservice.WorkflowServiceClient

type MockWorker

type MockWorker struct {
	// contains filtered or unexported fields
}

func (*MockWorker) GetTestActivityEnv

func (mw *MockWorker) GetTestActivityEnv() *testsuite.TestActivityEnvironment

func (*MockWorker) RegisterActivity

func (mw *MockWorker) RegisterActivity(a interface{})

func (*MockWorker) RegisterActivityWithOptions

func (mw *MockWorker) RegisterActivityWithOptions(a interface{}, options activity.RegisterOptions)

func (*MockWorker) RegisterWorkflow

func (mw *MockWorker) RegisterWorkflow(w interface{})

func (*MockWorker) RegisterWorkflowWithOptions

func (mw *MockWorker) RegisterWorkflowWithOptions(w interface{}, options workflow.RegisterOptions)

func (*MockWorker) Run

func (mw *MockWorker) Run(interruptCh <-chan interface{}) error

func (*MockWorker) Start

func (mw *MockWorker) Start() error

func (*MockWorker) Stop

func (mw *MockWorker) Stop()

type MockWorkflow

type MockWorkflow struct {
	Workflow any
	Option   workflow.RegisterOptions
}

type MockWorkflowRun

type MockWorkflowRun struct {
	Env *testsuite.TestWorkflowEnvironment
	ID  string
}

func (*MockWorkflowRun) Get

func (m *MockWorkflowRun) Get(ctx context.Context, valuePtr interface{}) error

func (*MockWorkflowRun) GetID

func (m *MockWorkflowRun) GetID() string

func (*MockWorkflowRun) GetRunID

func (m *MockWorkflowRun) GetRunID() string

func (*MockWorkflowRun) GetWithOptions

func (m *MockWorkflowRun) GetWithOptions(ctx context.Context, valuePtr interface{}, options client.WorkflowRunGetOptions) error

type MockedWorker

type MockedWorker interface {
	GetWorkflows() []MockWorkflow
	GetName() string
}

type TestFuture

type TestFuture[Resp any] struct {
	converter.EncodedValue
}

TestFuture is a wrapper of the test result of executing test activity.

func ExecuteTestActivity

func ExecuteTestActivity[Resp any](env *testsuite.TestActivityEnvironment, name string, params ...any) (*TestFuture[Resp], error)

func (*TestFuture[Resp]) Get

func (t *TestFuture[Resp]) Get() (Resp, error)

Jump to

Keyboard shortcuts

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