Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ to docs, or any other relevant information.

### Fixed

- Changed how test suites resolve workflow types for `ExecuteWorkflow` and `ExecuteChildWorkflow` when
registration aliasing is enabled (the default). Previously, implementation lookup used the workflow
type directly; it now performs an additional alias lookup, matching production workers. If `WorkflowA`
is registered as `"WorkflowB"` and `WorkflowB` as `"WorkflowC"`, executing `"WorkflowB"` now runs
function `WorkflowB` instead of `WorkflowA`. This unintuitive behavior brings test execution in line
with production.
- Fixed how `TestWorkflowEnvironment.OnWorkflow` resolves workflow types when registration aliasing is
enabled. If your test suite registered workflow `WorkflowA` as `"WorkflowB"` and registered `WorkflowB`
under another name, `OnWorkflow(WorkflowA, ...)` could incorrectly install the mock under that second
name. It now installs the mock under `"WorkflowB"`.
- Local activity mock lookup in `TestWorkflowEnvironment` no longer tries re-resolving the activity name.
This fixes a bug where two closures with different registered names would alias each other.
- mTLS client setup and schedule creation no longer modify caller-owned TLS
Expand Down
8 changes: 6 additions & 2 deletions internal/internal_workflow_testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,14 @@ func (env *testWorkflowEnvironmentImpl) executeWorkflowInternal(delayStart time.
}

func (env *testWorkflowEnvironmentImpl) getWorkflowDefinition(wt WorkflowType) (WorkflowDefinition, error) {
wf, ok := env.registry.getWorkflowFn(wt.Name)
lookup := wt.Name
if alias, ok := env.registry.getWorkflowAlias(lookup); ok {
lookup = alias
}
wf, ok := env.registry.getWorkflowFn(lookup)
if !ok {
supported := strings.Join(env.registry.getRegisteredWorkflowTypes(), ", ")
return nil, fmt.Errorf("unable to find workflow type: %v. Supported types: [%v]", wt.Name, supported)
return nil, fmt.Errorf("unable to find workflow type: %v. Supported types: [%v]", lookup, supported)
}
var dynamic bool
if d, ok := wf.(string); ok && d == "dynamic" {
Expand Down
3 changes: 0 additions & 3 deletions internal/workflow_testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,6 @@ func (e *TestWorkflowEnvironment) OnWorkflow(workflow any, args ...any) *MockCal
panic(err)
}
fnName, _ := GetWorkflowFunctionName(e.impl.registry, workflow)
if alias, ok := e.impl.registry.getWorkflowAlias(fnName); ok {
fnName = alias
}
e.impl.registry.RegisterWorkflowWithOptions(workflow, RegisterWorkflowOptions{DisableAlreadyRegisteredCheck: true})
call = e.workflowMock.On(fnName, args...)
case reflect.String:
Expand Down
Loading