Skip to content

test: fix flaky timing in test_cancel_terminated_invocation#619

Open
fgmacedo wants to merge 1 commit into
developfrom
fix/test-invoke-flaky-timing
Open

test: fix flaky timing in test_cancel_terminated_invocation#619
fgmacedo wants to merge 1 commit into
developfrom
fix/test-invoke-flaky-timing

Conversation

@fgmacedo
Copy link
Copy Markdown
Owner

Summary

  • Replace fixed 150 ms sleep + processing_loop with a deadline-bounded poll (20 ms ticks, 2 s ceiling) until ready enters the configuration
  • Same pattern used by other invoke tests is left untouched; this is the one that has been observed to flake on slower CI runners (Python 3.11 on GHA)

Context

The CI run for the merge of release/3.1.0 into develop failed on build (3.11):

FAILED tests/test_invoke.py::TestInvokeCancelAlreadyTerminated::test_cancel_terminated_invocation[async]
AssertionError: assert 'ready' in OrderedSet(['loading'])

The 150 ms wasn't enough for the executor to post done.invoke.loading before the assertion. The test was added before 3.0.0 (#571), so this is a pre-existing flake, not a 3.1.0 regression.

Locally the new version passed 10/10 runs.

Replace the fixed 150ms sleep with a deadline-bounded poll loop. On
slower CI runners (e.g., Python 3.11 on GitHub Actions) the executor
had not yet posted done.invoke.loading when the assertion ran, leaving
the configuration in 'loading' instead of 'ready'.

The new loop drives the processing loop in 20ms ticks until the final
state is reached, with a 2s ceiling.

Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (847f1d5) to head (eab55c6).

Additional details and impacted files
@@            Coverage Diff            @@
##           develop      #619   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           42        42           
  Lines         5027      5027           
  Branches       812       812           
=========================================
  Hits          5027      5027           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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