Repository navigation
test(tests): bind the test servers to a port the OS assigns - #198
Draft
greenhat616 wants to merge 1 commit into
Draft
greenhat616 wants to merge 1 commit into
greenhat616 wants to merge 1 commit into
Conversation
This was referenced Nov 9, 2026
greenhat616
force-pushed
the
test/hardening-34-port-race
branch
from
November 13, 2026 07:44
53b35d0 to
d1dd983
Compare
greenhat616
marked this pull request as draft
November 13, 2026 08:55
The test servers picked a free port with portpicker and bound it a moment later, so a server started in between by a parallel test could take it, and on Windows the bind then failed with os error 10048. They now bind 127.0.0.1:0 and read the port from the listener. portpicker has no other users and is dropped, along with the rand 0.8 packages only it pulled in.
greenhat616
force-pushed
the
test/hardening-34-port-race
branch
from
November 13, 2026 22:26
d1dd983 to
235f0f7
Compare
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.
Test infrastructure for the download strategy hardening stack. It is stacked on #197, which is its base branch. The design note is in §14.24.
Why
The test servers in
crates/bolt-load-tests/src/adapter/http_server.rscalledportpicker::pick_unused_port()and thenTcpListener::bindon that port. A parallel test could take the port in between, and on Windows the bind then failed with os error 10048. Before this fix, 2 of 40if_rangeruns failed this way. Earlier full runs on #197 hit it as well.What
bind_local(): a new private helper binds127.0.0.1:0and reads the port fromlocal_addr(). The same listener is handed toaxum::serve. It replaces both pick-then-bind sites, and the public helper signatures are unchanged.portpickeris dropped. Nothing else used it. The lock losesportpicker, rand 0.8.8, rand_chacha 0.3.1 and rand_core 0.6.4. Nothing was added or upgraded, and--lockedpasses.tests/empty_body.rsandbolt-load-adapter/tests/body_decoding.rsalready bind port 0.Verification
if_range: 40 runs of the test binary, 0 failures.resource_changed: 40 runs, 0 failures.Review
Reviewed with
/ccg:review, using the codex backend only (a single-model review).PASS (98/100). It confirmed three points:
Its Minor, the README still naming
portpicker, is fixed. Its suggestion is left as is: the adapters' unit tests buildlocalhostURLs, andlocalhostmay resolve to::1first. That predates this PR, and this change keeps the same bind address.Checks
All on
+nightly-2026-11-06, with--no-fail-fast. Clippy allowsunnecessary_lazy_evaluationsuntil #183 merges.cargo fmt --all -- --check.-D warnings.cargo doc: the same 18 errors as its base.