test(harness): wait for an HTTP response, not a bare TCP connect#346
Merged
vieiralucas merged 1 commit intomainfrom Apr 13, 2026
Merged
test(harness): wait for an HTTP response, not a bare TCP connect#346vieiralucas merged 1 commit intomainfrom
vieiralucas merged 1 commit intomainfrom
Conversation
The e2e and conformance test harnesses both spawn fakecloud as a child process and then block on a 30s wait_for_port loop that considers the server ready as soon as TcpStream::connect succeeds. A successful TCP connect only proves fakecloud's listener socket is in the kernel accept queue — it does not prove axum has reached serve().await and installed the request handlers. Tests that issued a real HTTP request immediately after the TCP probe occasionally raced that window and saw ConnectionRefused / early EOF across unrelated services (RDS, IAM OIDC, Bedrock, KMS, SES). Upgrade wait_for_port to a two-stage probe: first wait for TCP to connect, then issue a reqwest GET to http://127.0.0.1:{port}/. Any HTTP response — including 404 from an unmatched route — proves axum is actually serving, which is the guarantee the tests need.
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
Both test harnesses (`crates/fakecloud-e2e/tests/helpers/mod.rs` and `crates/fakecloud-conformance/tests/helpers/mod.rs`) spawn fakecloud as a child process and gate `TestServer::start` on a `wait_for_port` loop that only checks `TcpStream::connect`. A successful TCP connect proves fakecloud's listener socket is in the kernel accept queue, but not that axum has reached `serve().await` and installed the request handlers. Tests that issued a real HTTP call immediately after the TCP probe occasionally raced that window and saw `ConnectionRefused` / early EOF — prior sessions blamed this on flakes across RDS, IAM OIDC, Bedrock, KMS, and SES and just re-ran the workflow instead of investigating.
Fix: two-stage readiness probe.
`reqwest` is already a dev-dependency in both crates, so this is zero new cost.
Test plan
Summary by cubic
Make the e2e and conformance test harnesses wait for a real HTTP response before running tests. This ensures
axumis serving and eliminates ConnectionRefused/early-EOF flakes in CI.reqwestGET tohttp://127.0.0.1:{port}/; any HTTP status (including 404) counts as ready.Written for commit 6c41896. Summary will update on new commits.