Open dorsec opened 2 years ago
@dorsec - I am assuming you're talking about testsuite.TestWorkflowEnvironment.ExecuteWorkflow
and not mocks.Client.ExecuteWorkflow
, correct?
Can you provide more information on how you are using the context to Client.ExecuteWorkflow
? The context is for client calls only (and there is no client for the testsuite) and doesn't really affect the running of the workflow.
Also, in the master branch and soon to be released, if it helps you, there are now Interceptors
on the worker options which support intercepting both outbound (i.e. client call) and inbound (i.e. workflow invocation request) ExecuteWorkflow
calls. They can perform similar functions to context propagators though, so likely unrelated to the root of this problem.
The code in my workflows/activities may rely on context information (e.g. user ID).
So, in tests, it needs to be passed from somewhere - and testsuite.TestWorkflowEnvironment.ExecuteWorkflow
doesn't allow for it :)
The code in my workflows/activities may rely on context information (e.g. user ID).
But you can't inject user values into the context that is given to your workflow (unless you're using interceptors or context propagators). The internal system creates the workflow.Context
. Same for activities and context.Context
. If you have multiple workers, sometimes the workers/activities run on completely different machines than where they were executed.
Can you give me an example of what you're doing without the test environment and maybe I can show how you can do it with the test environment?
Is your feature request related to a problem? Please describe. In our tests, we need to jump through hoops and provide a custom Context Propagator, because the mock version of
ExecuteWorkflow
doesn't take in a context.Context param. The regular (production) version ofExecuteWorkflow
DOES accept such a parameter.Describe the solution you'd like Add a ctx param to the mock variant of
ExecuteWorkflow
and propagate it.