test: fix flaky test_runs_concurrently by asserting peak concurrency instead of wall time#2073
Open
vdusek wants to merge 1 commit into
Open
test: fix flaky test_runs_concurrently by asserting peak concurrency instead of wall time#2073vdusek wants to merge 1 commit into
vdusek wants to merge 1 commit into
Conversation
…instead of wall time
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2073 +/- ##
==========================================
- Coverage 93.41% 93.37% -0.05%
==========================================
Files 179 179
Lines 12496 12496
==========================================
- Hits 11673 11668 -5
- Misses 823 828 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
test_runs_concurrentlyverifies thatAutoscaledPoolruns tasks concurrently rather than sequentially. It inferred this from the total wall time (elapsed.wall < 0.3), which is a fragile proxy: on a slow CI runner (seen on windows-latest / Python 3.14) event-loop scheduling overhead pushed the wall time to 0.314 s even though all 10 tasks did overlap, tripping the tight 0.3 s threshold.This replaces the timing proxy with a direct, deterministic assertion of the property the test actually protects: the peak number of tasks running simultaneously must reach the configured concurrency (10). The check no longer depends on wall-clock time, so it can't flake under CI load or on slow runners, and it's stronger than before (a sequential or only partially concurrent pool would peak below 10, whereas the old wall-time check could pass at partial concurrency).
Verified locally: a harness replicating the exact pool setup reached peak 10 in 200/200 iterations under 2x CPU oversubscription; the test passes 0 failures across repeated runs; lint and type checks pass.