test(extract): make the fan-out drain test deterministic - #1165
Merged
Merged
Conversation
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.
Summary
Makes
test_concurrent_fan_out_drains_in_flight_windows_before_it_raisesdeterministic. The old test ordered a slow window against a failing one withtime.sleep(0.3), so on a loaded runner window 1 could be cancelled before it started and thedrainedflag was never set. The new test orders everything withthreading.Events: window 0 fails only after window 1 is provably in its call, window 1 stays there until the test releases it, and the test asserts the fan-out is still running while window 1 is in flight, then that it raisedOllamaUnavailableafter the drain. Test-only; no production change.Related issue
Closes #1164
Type of change
How was this tested?
pool.shutdown(wait=True, ...)towait=Falseinextraction/concept.pyturns the test red (assert runner.is_alive(), "fan-out returned with a window in flight"); reverted byte-exactly and__pycache__purged.ruff check .,ruff format --check .,mypy .clean;tests/unit/extraction/test_concept.py368 passed.Checklist
Notes for reviewers
The bounded
runner.join(timeout=0.5)only bounds the failing (mutant) case; with a correct drain the runner cannot finish while window 1 is held, so the assertion cannot flake.Other
time.sleep(used for thread ordering intests/unit/extractionandtests/unit/cli/test_ingest.py: none. The only remaining match is a docstring attest_concept.py(_WindowKeyedLLM-adjacent test) that explains why a sleep is not used.