Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose SetContinuedAsNewRunID in the TestWorkflowEnvironment #1246

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/internal_workflow_testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ func (env *testWorkflowEnvironmentImpl) setContinueAsNewSuggested(suggest bool)
env.workflowInfo.continueAsNewSuggested = suggest
}

func (env *testWorkflowEnvironmentImpl) setContinuedExecutionID(rid string) {
env.workflowInfo.ContinuedExecutionRunID = rid
}

func (env *testWorkflowEnvironmentImpl) newTestWorkflowEnvironmentForChild(params *ExecuteWorkflowParams, callback ResultHandler, startedHandler func(r WorkflowExecution, e error)) (*testWorkflowEnvironmentImpl, error) {
// create a new test env
childEnv := newTestWorkflowEnvironmentImpl(env.testSuite, env.registry)
Expand Down
6 changes: 6 additions & 0 deletions internal/internal_workflow_testsuite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3747,6 +3747,12 @@ func (s *WorkflowTestSuiteUnitTest) Test_SetWorkerStopChannel() {
s.NotNil(env.workerStopChannel)
}

func (s *WorkflowTestSuiteUnitTest) Test_SetContinuedExecutionRunID() {
env := newTestWorkflowEnvironmentImpl(&s.WorkflowTestSuite, nil)
env.setContinuedExecutionID("some-run-id")
s.NotNil(env.workflowInfo.ContinuedExecutionRunID)
}

func (s *WorkflowTestSuiteUnitTest) Test_ActivityTimeoutWithDetails() {
count := 0
timeoutFn := func() error {
Expand Down
6 changes: 6 additions & 0 deletions internal/workflow_testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ func (e *TestWorkflowEnvironment) SetContinueAsNewSuggested(suggest bool) {
e.impl.setContinueAsNewSuggested(suggest)
}

// SetContinuedExecutionID sets the value that is returned from
// GetInfo(ctx).ContinuedExecutionRunID
func (e *TestWorkflowEnvironment) SetContinuedAsNewRunID(rid string) {
e.impl.setContinuedExecutionID(rid)
}
lminaudier marked this conversation as resolved.
Show resolved Hide resolved

// OnActivity setup a mock call for activity. Parameter activity must be activity function (func) or activity name (string).
// You must call Return() with appropriate parameters on the returned *MockCallWrapper instance. The supplied parameters to
// the Return() call should either be a function that has exact same signature as the mocked activity, or it should be
Expand Down
Loading