make flow tests deterministic - #11
Merged
Merged
Conversation
Coverage Report for CI Build 32220042359Coverage increased (+0.4%) to 90.618%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
TestFlowWithTimeout gave 100 inputs to 40 workers sleeping a second each, so the work needed exactly the three seconds of its own deadline and the race between them decided whether the flow was canceled at all. It failed about one run in ten. Progress is now released by the test, one input per worker and no more, so the deadline always lands with inputs left and the assertion counts what was processed instead of measuring elapsed time. The test also takes 0.5s instead of 3s. The cancellation path in merge was covered only when a merge goroutine happened to be blocked in Send at cancellation, which moved the reported coverage between identical runs and failed the coveralls check on pull requests. TestFlowParallelCanceledOnMerge covers both paths every run: the stage below the merge never reads its input, so the record emitted by the first worker can only leave through the canceled context, while the second worker closes its channel without emitting.
paskal
force-pushed
the
stabilise-flow-tests
branch
from
August 19, 2026 05:36
bb6e12b to
7224ab2
Compare
umputun
approved these changes
Aug 19, 2026
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.
Two tests in the root package were decided by the scheduler rather than by the code under test.
TestFlowWithTimeoutgave 100 inputs to 40 workers sleeping a second each, so the work needed exactly the three seconds of its own deadline, and which of the two won decided whether the flow was cancelled at all. It failed roughly one run in ten locally. The test now releases progress itself, as many inputs as there are workers and no more, so the deadline always lands with inputs left over, and it asserts on how much was processed rather than on elapsed time. It also drops from 3s to 0.5s.The cancelled-
Sendpath inmergewas covered only when a merge goroutine happened to be blocked there at cancellation. That moved the reported coverage between runs of the same commit - the two builds of the head of #5 reported 88.7% and 87.8% - which is why coveralls fails PRs in this repo at random, including the doc-only #9.TestFlowParallelCanceledOnMergecovers both paths on every run: the stage below the merge never reads its input, so the record emitted by the first worker can only leave through the cancelled context, while the second worker closes without emitting.Root package coverage is now identical on every run, verified over 20 plain runs, race runs and isolated runs.
The
poolpackage still varies by about 1.2%, in the worker select inGowhere the parent context and the errgroup context are both ready and go picks either branch. No test can pin that down without changing how the pool reports cancellation, so it is left alone - worth knowing since #6 starts measuringpoolon CI.