Jetja
February 6, 2023, 2:50pm
1
I’m trying to create a workflowtest for my workflow. The workflow executes 3 activities of which 2 are running in a worker session. The first activity saves a temporary file that is used by the 2nd activity. I’m mocking the activities, but I get the following error when I try to run the workflow_test.go:
unable to find activityType=internalSessionCreationActivity. Supported types: [GenerateSecretInAppReg, AKSRunningCheck, UpdateSecretValueInKeyVault] (type: ActivityNotRegisteredError, retryable: true)
I receive the error when this line of code is executed:
require.NoError(t, env.GetWorkflowError())
Jetja
February 7, 2023, 9:53am
2
I have tried :
env.OnActivity(workflow.CreateSession, mock.Anything, mock.Anything).Return(mock.Anything, nil)
env.OnActivity(internal.CreateSession, mock.Anything, mock.Anything).Return(mock.Anything, nil)
However, workflow.CreateSession doesn’t add the right activity, and internal.CreateSession is not allowed.
maxim
February 7, 2023, 1:53pm
3
Try setting worker.Options.EnableSessionWorker
to true
. And then use TestWorkflowEnvironment.setOptions
.
Jetja
February 7, 2023, 2:28pm
4
Thanks I fixed it with your guidance in the right direction! I placed this in my test:
workerOptions := worker.Options{
EnableSessionWorker: true,
}
env.SetWorkerOptions(workerOptions)