Documentation ¶
Index ¶
- func EmptyClientsBuilder(context.Context, string, *client.Options) (client.Client, error)
- func MockClientsBuilder(mocks ...MockedWorker) func(context.Context, string, *client.Options) (client.Client, error)
- func MockWorkerBuilder(client client.Client, taskQueue string, options worker.Options) worker.Worker
- func NewEnvWithWorkflows(wfs ...MockWorkflow) *testsuite.TestWorkflowEnvironment
- func NewTemporalMockClient(env *testsuite.TestWorkflowEnvironment) client.Client
- func PatchedService[AppConfig, ServiceInterface any](t syslgo.TestingT, ...) func(context.Context, AppConfig) (ServiceInterface, *core.Hooks, error)
- type MockBase
- func (m *MockBase[Resp]) BuildMockActivity() func(context.Context, ...any) (Resp, error)
- func (m *MockBase[Resp]) BuildMockActivityWithoutReturn() func(context.Context, ...any) error
- func (m *MockBase[Resp]) BuildMockWorkflow() func(workflow.Context, ...any) (Resp, error)
- func (m *MockBase[Resp]) BuildMockWorkflowWithoutReturn() func(workflow.Context, ...any) error
- func (m *MockBase[Resp]) CheckExpectations(actual ...any)
- func (m *MockBase[Resp]) ExpectOptions(opt client.StartWorkflowOptions)
- func (m *MockBase[Resp]) ExpectRequest(req ...any)
- func (m *MockBase[Resp]) IsMocked() bool
- func (m *MockBase[Resp]) MockErrorOnlyResponse(err error)
- func (m *MockBase[Resp]) MockResponse(resp Resp, err error)
- type MockClient
- func (m *MockClient) CancelWorkflow(ctx context.Context, workflowID string, runID string) error
- func (m *MockClient) CheckHealth(ctx context.Context, request *client.CheckHealthRequest) (*client.CheckHealthResponse, error)
- func (m *MockClient) Close()
- func (m *MockClient) CompleteActivity(ctx context.Context, taskToken []byte, result interface{}, err error) error
- func (m *MockClient) CompleteActivityByID(ctx context.Context, namespace, workflowID, runID, activityID string, ...) error
- func (m *MockClient) CountWorkflow(ctx context.Context, request *workflowservice.CountWorkflowExecutionsRequest) (*workflowservice.CountWorkflowExecutionsResponse, error)
- func (m *MockClient) DescribeTaskQueue(ctx context.Context, taskqueue string, taskqueueType enumspb.TaskQueueType) (*workflowservice.DescribeTaskQueueResponse, error)
- func (m *MockClient) DescribeWorkflowExecution(ctx context.Context, workflowID, runID string) (*workflowservice.DescribeWorkflowExecutionResponse, error)
- func (m *MockClient) ExecuteWorkflow(ctx context.Context, options client.StartWorkflowOptions, workflow interface{}, ...) (client.WorkflowRun, error)
- func (m *MockClient) GetEnv() *testsuite.TestWorkflowEnvironment
- func (m *MockClient) GetSearchAttributes(ctx context.Context) (*workflowservice.GetSearchAttributesResponse, error)
- func (m *MockClient) GetWorkflow(ctx context.Context, workflowID string, runID string) client.WorkflowRun
- func (m *MockClient) GetWorkflowHistory(ctx context.Context, workflowID string, runID string, isLongPoll bool, ...) client.HistoryEventIterator
- func (m *MockClient) ListArchivedWorkflow(ctx context.Context, ...) (*workflowservice.ListArchivedWorkflowExecutionsResponse, error)
- func (m *MockClient) ListClosedWorkflow(ctx context.Context, ...) (*workflowservice.ListClosedWorkflowExecutionsResponse, error)
- func (m *MockClient) ListOpenWorkflow(ctx context.Context, ...) (*workflowservice.ListOpenWorkflowExecutionsResponse, error)
- func (m *MockClient) ListWorkflow(ctx context.Context, request *workflowservice.ListWorkflowExecutionsRequest) (*workflowservice.ListWorkflowExecutionsResponse, error)
- func (m *MockClient) OperatorService() operatorservice.OperatorServiceClient
- func (m *MockClient) QueryWorkflow(ctx context.Context, workflowID string, runID string, queryType string, ...) (converter.EncodedValue, error)
- func (m *MockClient) QueryWorkflowWithOptions(ctx context.Context, request *client.QueryWorkflowWithOptionsRequest) (*client.QueryWorkflowWithOptionsResponse, error)
- func (m *MockClient) RecordActivityHeartbeat(ctx context.Context, taskToken []byte, details ...interface{}) error
- func (m *MockClient) RecordActivityHeartbeatByID(ctx context.Context, namespace, workflowID, runID, activityID string, ...) error
- func (m *MockClient) ResetWorkflowExecution(ctx context.Context, request *workflowservice.ResetWorkflowExecutionRequest) (*workflowservice.ResetWorkflowExecutionResponse, error)
- func (m *MockClient) ScanWorkflow(ctx context.Context, request *workflowservice.ScanWorkflowExecutionsRequest) (*workflowservice.ScanWorkflowExecutionsResponse, error)
- func (m *MockClient) ScheduleClient() client.ScheduleClient
- func (m *MockClient) SignalWithStartWorkflow(ctx context.Context, workflowID string, signalName string, ...) (client.WorkflowRun, error)
- func (m *MockClient) SignalWorkflow(ctx context.Context, workflowID string, runID string, signalName string, ...) error
- func (m *MockClient) TerminateWorkflow(ctx context.Context, workflowID string, runID string, reason string, ...) error
- func (m *MockClient) UpdateWorkflow(ctx context.Context, workflowID string, workflowRunID string, ...) (client.WorkflowUpdateHandle, error)
- func (m *MockClient) UpdateWorkflowWithOptions(ctx context.Context, request *client.UpdateWorkflowWithOptionsRequest) (client.WorkflowUpdateHandle, error)
- func (m *MockClient) WorkflowService() workflowservice.WorkflowServiceClient
- type MockWorker
- func (mw *MockWorker) GetTestActivityEnv() *testsuite.TestActivityEnvironment
- func (mw *MockWorker) RegisterActivity(a interface{})
- func (mw *MockWorker) RegisterActivityWithOptions(a interface{}, options activity.RegisterOptions)
- func (mw *MockWorker) RegisterWorkflow(w interface{})
- func (mw *MockWorker) RegisterWorkflowWithOptions(w interface{}, options workflow.RegisterOptions)
- func (mw *MockWorker) Run(interruptCh <-chan interface{}) error
- func (mw *MockWorker) Start() error
- func (mw *MockWorker) Stop()
- type MockWorkflow
- type MockWorkflowRun
- type MockedWorker
- type TestFuture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmptyClientsBuilder ¶
func MockClientsBuilder ¶
func MockWorkerBuilder ¶
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 (*MockBase[Resp]) BuildMockActivity ¶
func (*MockBase[Resp]) BuildMockActivityWithoutReturn ¶
func (*MockBase[Resp]) BuildMockWorkflow ¶
func (*MockBase[Resp]) BuildMockWorkflowWithoutReturn ¶
func (*MockBase[Resp]) CheckExpectations ¶
func (*MockBase[Resp]) ExpectOptions ¶
func (m *MockBase[Resp]) ExpectOptions(opt client.StartWorkflowOptions)
func (*MockBase[Resp]) ExpectRequest ¶
func (*MockBase[Resp]) MockErrorOnlyResponse ¶
func (*MockBase[Resp]) MockResponse ¶
type MockClient ¶
type MockClient struct {
Env *testsuite.TestWorkflowEnvironment
}
func (*MockClient) CancelWorkflow ¶
func (*MockClient) CheckHealth ¶
func (m *MockClient) CheckHealth(ctx context.Context, request *client.CheckHealthRequest) (*client.CheckHealthResponse, error)
func (*MockClient) Close ¶
func (m *MockClient) Close()
func (*MockClient) CompleteActivity ¶
func (*MockClient) CompleteActivityByID ¶
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) 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 (m *MockClient) GetEnv() *testsuite.TestWorkflowEnvironment
func (*MockClient) GetSearchAttributes ¶
func (m *MockClient) GetSearchAttributes(ctx context.Context) (*workflowservice.GetSearchAttributesResponse, 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) 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) QueryWorkflowWithOptions ¶
func (m *MockClient) QueryWorkflowWithOptions(ctx context.Context, request *client.QueryWorkflowWithOptionsRequest) (*client.QueryWorkflowWithOptionsResponse, 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 (*MockClient) TerminateWorkflow ¶
func (*MockClient) UpdateWorkflow ¶ added in v0.303.0
func (m *MockClient) UpdateWorkflow( ctx context.Context, workflowID string, workflowRunID string, updateName string, args ...interface{}, ) (client.WorkflowUpdateHandle, error)
func (*MockClient) UpdateWorkflowWithOptions ¶ added in v0.303.0
func (m *MockClient) UpdateWorkflowWithOptions( ctx context.Context, request *client.UpdateWorkflowWithOptionsRequest, ) (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)
Click to show internal directories.
Click to hide internal directories.