Skip to content

Fix flaky test: TestTooManyCancelRequests/CancelAllWorkflowsAtOnce#8860

Open
spkane31 wants to merge 1 commit intomainfrom
spk/flaky-cancel-wfs-test
Open

Fix flaky test: TestTooManyCancelRequests/CancelAllWorkflowsAtOnce#8860
spkane31 wants to merge 1 commit intomainfrom
spk/flaky-cancel-wfs-test

Conversation

@spkane31
Copy link
Contributor

What changed?

Fixed race condition in TestClientMiscTestSuite/TestTooManyCancelRequests/CancelAllWorkflowsAtOnce by reordering test operations to wait for workflow completion before checking history.

Why?

The test was failing intermittently in CI with:

Error: Not equal: 
    expected: 4
    actual  : 2 (or 3)
Messages: Length of expected(4) and actual(2) histories is not equal

The test was checking workflow history immediately after starting the workflow, before ensuring the workflow task had been executed by a worker. This created a race condition where the test could check history before all events were persisted (WorkflowTaskStarted and WorkflowTaskFailed events).

The fix reorders operations to call run.Get() (which waits for workflow completion) before WaitForHistoryEvents(). This ensures proper synchronization and that all history events are persisted before verification.

This follows the same pattern used in TestTooManyPendingSignals in the same file.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests

@spkane31 spkane31 requested review from a team as code owners December 17, 2025 23:55
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.

1 participant