test: drain loopback HTTP request bodies - #260
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
Content-Lengthbefore sending scripted responsesWhy are you making this contribution?
The post-merge Windows Platform run for PR #259 failed
should_retry_s3_conditional_request_conflict_when_creating_object. The scripted server performed one arbitrary 4 KiB read, replied, and closed without proving the PUT body had been consumed. A first refinement exposed the platform-specific root cause directly: accepted sockets inherited the listener's nonblocking mode on Windows, so the read returnedWouldBlock. Some fixtures panicked; others ignored the error, closed with the request unread, and surfaced a reset instead of their scripted response.Linked issues
No issue: follow-up to the Windows Platform failure found while completing PR #259.
Acceptance audit
Evidence: Platform run 32861046364 captured Windows error 10035 (
WouldBlock) from the inherited nonblocking accepted socket before the refinement; Platform run 32862582023 passes the complete workspace on both Windows and macOS after it.Production entry point: The regressions exercise
CloudExecutor::execute_requestandS3Backend::submit_putthrough real loopback HTTP connections; only test support is modified.Resolution: Explicitly switches every accepted connection from a nonblocking listener back to blocking mode with a bounded read timeout.
Evidence:
storage::providers::s3::tests::should_retry_s3_conditional_request_conflict_when_creating_objectpasses after the fixture change; Platform run 32859180767 captured the initial Windows failure.Production entry point: The regression exercises
S3Backend::submit_putand the real cloud executor through a loopback HTTP connection.Resolution: Reads headers, parses
Content-Lengthcase-insensitively, and continues reading until the declared body is present before writing the scripted response.Evidence:
cargo test --workspace --all-featurespasses the complete library, integration, and doctest suite, including provider header and request-shape tests.Production entry point: AWS, Azure, and GCS tests exercise their production provider implementations against the shared recording fixture.
Resolution: Reuses the complete-request reader before parsing the existing method, target, and headers.
Risk and compatibility
Low risk and test-only. No public API, production behavior, persistence format, dependency, or runtime timeout changes. Fixture reads retain a five-second socket timeout and caller-owned server shutdown.
Verification
cargo test --all-features storage::providers::s3::tests::should_retry_s3_conditional_request_conflict_when_creating_object -- --exact --nocapture— passedcargo test --lib --all-features storage::cloud::executor::tests::should_not_retry -- --nocapture— passed; all three mutation retry testscargo test --workspace --all-features— passed; complete library, integration, and doctest suitecargo clippy --workspace --all-targets --all-features -- -D warnings -D clippy::pedantic— passedcargo fmt --check— passedcntryl-tools validate-tests— passed; 2,440/2,440 compliantgit diff --check— passedTool assistance disclosure
Codex correlated the Windows socket failures with inherited nonblocking accepted sockets and incomplete request reads, refined both fixture families, reviewed the diff, and ran the verification above.
Contributor responsibility
Review checklist