Fix OnWorkflow mock to see propagated context headers#2212
Open
kritibehl wants to merge 1 commit intotemporalio:masterfrom
Open
Fix OnWorkflow mock to see propagated context headers#2212kritibehl wants to merge 1 commit intotemporalio:masterfrom
kritibehl wants to merge 1 commit intotemporalio:masterfrom
Conversation
Contributor
|
Thanks for the contribution, could we write a test to verify this fix? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
Updated the testsuite OnWorkflow mock execution path to ensure propagated workflow headers are visible to mock matchers.
Specifically, after creating ctxCopy via newWorkflowContext(...), the testsuite now applies:
workflowContextWithHeaderPropagated(ctxCopy, w.env.header, w.env.GetContextPropagators())
before invoking getWorkflowMockReturn(...).
Why?
Issue #2005 reports that OnWorkflow mock matchers cannot observe headers propagated via workflow context propagators, even though real child workflow execution correctly sees them.
Root cause:
The testsuite creates a copied workflow context (ctxCopy) for mock execution, but did not apply header propagation to that context. As a result, propagated values were missing when evaluating OnWorkflow matchers.
This change ensures the mock receives the same header-propagated workflow context as real workflow execution, restoring expected behavior and consistency.
Checklist
1.Closes #2005
How was this tested:
go test ./... -count=1
go test ./... -race -count=1
Verified that the change does not impact existing tests.
No documentation changes required (testsuite behavioral consistency fix).