Skip to content

fix(tests): health-check wait in serve_integration — unflakes Proptest#165

Closed
avrabe wants to merge 0 commit intomainfrom
fix/serve-integration-health-wait
Closed

fix(tests): health-check wait in serve_integration — unflakes Proptest#165
avrabe wants to merge 0 commit intomainfrom
fix/serve-integration-health-wait

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 21, 2026

The flake

`api_artifacts_unfiltered` and `api_artifacts_search` in `serve_integration.rs` intermittently fail on `assert_eq!(status, 200)` — parsed status is 0, meaning the HTTP response was empty or unparseable. Happens under Proptest (extended) load (PROPTEST_CASES=1000, high CPU pressure).

Root cause

`start_server()` waits for TCP accept, then returns. But the socket binds before the artifact store finishes loading. Under load, `fetch()` races and hits the server mid-load, getting a closed connection or an error response.

Fix

Poll `/api/v1/health` until it returns HTTP/1.1 200 before declaring the server ready. The health handler only becomes reachable after routing is fully initialized and the store is populated.

Same 30s timeout, same retry cadence — just a stricter readiness check.

Test plan

  • `cargo build -p rivet-cli --tests` clean
  • CI green — this is the CI fix

This PR blocks nothing it doesn't fix. Other PRs (#157 salsa especially) can rebase to pick this up.

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe closed this Apr 21, 2026
@avrabe avrabe force-pushed the fix/serve-integration-health-wait branch from 3c0c08d to 60d728a Compare April 21, 2026 18:58
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