Skip to content

Conversation

yuandrew
Copy link
Contributor

@yuandrew yuandrew commented Jun 9, 2025

What was changed

Dispatch a new coroutine with workflow context when canceling external workflow in workflow testsuite

Why?

Fix testsuite specific error

Checklist

  1. Closes Getting a strange error when writing tests which does not occur in real temporal deployment #1961

  2. How was this tested:
    Added test

@yuandrew yuandrew requested a review from a team as a code owner June 9, 2025 15:57
@Quinn-With-Two-Ns
Copy link
Contributor

Do you know why the feature tests are failing for your PR?

@yuandrew
Copy link
Contributor Author

Seems like it was a transient issue, features tests are passing now after merging with master

env.postCallback(func() {
env.onChildWorkflowCanceledListener(env.workflowInfo)
}, false)
sd.dispatcher.NewCoroutine(sd.rootCtx, "cancel-self", true, func(ctx Context) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't running the postCallback enough?

Copy link
Contributor Author

@yuandrew yuandrew Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment explaining why this would be needed, not sure it's worth a larger refactor, lmk if you think otherwise

// The way testWorkflowEnvironment is setup today, we close the child workflow dispatcher before calling
// the workflowCancelHandler. A larger refactor would be needed to handle this similar to non-test code.
// Maybe worth doing when https://github.com/temporalio/go-sdk/issues/50 is tackled.

@yuandrew yuandrew changed the title Fix canceling external workflow in Selector Fix canceling external workflows that are children in testsuite Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting a strange error when writing tests which does not occur in real temporal deployment
2 participants