Repository navigation
Description
Parent EPIC: #2392
Problem
Some tests choose a port by binding loopback port 0, reading the address, and dropping the socket before the system under test binds it; a parallel test can claim the port in between. Other tests use fixed ports inside Linux's ephemeral range (32768-60999), so a concurrent port-0 bind can receive the same port. The result is an intermittent Address already in use failure unrelated to the behavior under test.
Reproduction
Local, develop at 4d64d3c34, cargo-nextest 0.9.88, 32 logical processors:
- The two
axum-http-serverduplicate-registration tests alone: 200 runs, 0 failures. - The
axum-http-serverpackage suite: 100 runs, 0 failures. - The full suite (
cargo nextest run --tests --all-features --no-fail-fast): 51 runs, 2 failures:server::tests::it_should_release_the_listener_and_preserve_the_duplicate_binding_error_when_registration_fails:Address already in use (os error 98). The same failure appeared in the bug(container): eliminate manual developer-tool integration #2298 container build.base_source_precedence::it_should_select_the_cli_configuration_when_both_child_environment_base_sources_are_set: the health-check API could not bind its fixed port43152.
Plan
- T1 (done): reproduce and inventory.
- T2-T3: repair the
axum-http-serverfixture so the address is not released before the server owns it; prove the regression test red, then green. - T4: repair the CLI precedence test. It needs three distinct predictable ports, so plain port
0cannot identify the winning source; use ports outside the ephemeral range or exclusively owned addresses. - T5: audit other Rust-test port fixtures (including
tests/metrics/fixed_ports.rs, a deliberate fixed-port test). - T6: repeat the full-suite reproduction and complete the review.
Out of scope: E2E container host ports (sibling subissue), serializing the suite, production listener behavior.
The full specification is added to docs/issues/open/ by a spec-only pull request.
Activity
docs(issues): record spec-only PR torrust#2397 in test isolation subi…
docs(issues): [torrust#2393] quote the evidence timestamp
docs(issues): add test isolation EPIC #2392 and subissue specs
Merge #2397: docs(issues): [#2392] add test isolation EPIC and subiss…
Merge #2409: chore(issues): archive closed issue #2386 spec to docs/i…
revert: [torrust#2393] undo the shared port helper move and fixture c…
fix(tests): [torrust#2393] ignore racing port tests and rewrite those…
fix(tests): [torrust#2393] ignore the tests that rebind a released port
docs(issues): [torrust#2393] stamp the progress log entry with its ti…
docs(issues): [torrust#2393] mark the plan rows by what ran and the e…
68 remaining items
test(axum-health-check-api-server): [torrust#2867] register T3 and st…
docs(issues): [torrust#2867] record the replacement stopped-UDP test …
Merge #2879: fix(tracker-client): [#2867] report an invalid UDP healt…
chore(issues): [torrust#2393] archive the closed issue spec and mark …
docs(issues): [torrust#2393] stamp the archive entries with the archi…
docs(issues): [torrust#2392] mark Phase 1 done and sync AC2 and the c…
docs(issues): [torrust#2393] state the T11 close-out in the past tense
docs(pr-reviews): [torrust#2393] add the PR 2883 review audit
docs(issues): [torrust#2392] give the restored tests' non-Linux ignor…
docs(pr-reviews): [torrust#2393] record da2ce7's second-round finding…
docs(pr-reviews): [torrust#2393] cite F6's fix by its reply in the PR…
docs(pr-reviews): [torrust#2393] record Copilot's re-raise of F7 in t…
Merge #2883: chore(issues): [#2393] archive the closed issue spec and…
docs(issues): [torrust#2392] keep the torrust#2906 approach and torru…
Merge #2910: docs(issues): [#2392] add the #2394 audit's new issues a…