我正在为时间工作流编写集成测试并使用 golang sdk。我的工作流程有一个活动,其中包括以下代码:
stackEnv, ok := ctx.Value("stackEnv").(*StackEnv)
if !ok {
return nil, errors.New("stackEnv not configured")
}
在我的测试中,我创建了一个TestWorkflowEnvironment
并使用s.env.ExecuteWorkflow(EntityCreateWorkflow, wfParams)
. 但是,我在测试中遇到错误,stackEnv not configured
因为context.Context
在测试环境中运行的活动没有stackEnv
设置。如何为我的 指定自定义上下文TestWorkflowEnvironment
?