Skip to content

test: de-flake all discovery + ingest timing tests#58

Merged
TCVinNYC merged 1 commit into
mainfrom
test/deflake-discovery
Jun 22, 2026
Merged

test: de-flake all discovery + ingest timing tests#58
TCVinNYC merged 1 commit into
mainfrom
test/deflake-discovery

Conversation

@TCVinNYC

Copy link
Copy Markdown
Member

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).

  • All 17 test_discovery.py tests + 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.
  • Two "unavailable" tests start no thread, so their sleeps are removed.
  • No behavioral change; faster (discovery+ingest ~4.7 s vs ~8 s). Verified 771 passing, discovery+ingest stable across repeated runs.

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

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>
@TCVinNYC TCVinNYC merged commit 569905b into main Jun 22, 2026
3 checks passed
@TCVinNYC TCVinNYC deleted the test/deflake-discovery branch June 22, 2026 06:27
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