test: de-flake all discovery + ingest timing tests#58
Merged
Conversation
Following the two thread-timing flakes fixed for the release, sweep the rest of the fixed-sleep-then-assert pattern out of the suite. All 17 discovery tests started a background poll thread, slept a fixed window (0.1–0.6 s vs a 0.05–0.1 s poll interval — thin margin under CI load), then asserted on collected events; the RTSP reconnect test slept a fixed 1 s waiting for ≥2 opens. Replace each with a `_wait_until(predicate)` poll on the asserted condition, so the tests return as soon as the work lands and only wait long under genuine stalls. Two "unavailable" tests start no thread, so their sleeps are simply removed. Net effect: no behavioral change, more robust, and faster (discovery+ingest ~4.7 s vs ~8 s). Left as-is: sleeps inside fake read/open callbacks (simulated work), poll-loop bodies, the debounce-window test, and asserts that depend on stop()/shutdown rather than on the sleep. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Sweeps the fixed-sleep-then-assert antipattern out of the suite (the root cause of the two macOS CI flakes hit during the 2.1.0-rc1 release).
test_discovery.pytests + the RTSP-reconnect test now_wait_until(predicate)on the asserted condition instead of sleeping a fixed window, so they're immune to a loaded CI runner stalling the background poll thread.Left intact: sleeps inside fake callbacks (simulated work), poll-loop bodies, the debounce-window timing test, and asserts that depend on
stop()rather than the sleep.🤖 Generated with Claude Code