Repository navigation
fix(tests): pick a port free on loopback too in the wildcard port-probe test (#4445) - #4446
Merged
Merged
Conversation
…be test (#4445) test_wildcard_probe_sees_a_bind_on_another_local_address bound (127.0.0.2, 0) and then bound 127.0.0.1 on the same port. The kernel only guarantees the port free on the address asked, so whenever another socket on the runner held it on 127.0.0.1 the loopback bind raised EADDRINUSE (and the busy assertion passed for the wrong reason). Seen twice in a row on #4443. _hold_port_free_on_loopback now confirms the 127.0.0.1 side is bindable while the other-address bind is held, retrying up to 50 times. Regression test test_port_choice_skips_a_port_already_taken_on_loopback injects a port busy on 127.0.0.1 and asserts it is skipped. Fixes #4445 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Fixes #4445
What
test_wildcard_probe_sees_a_bind_on_another_local_addressbound(127.0.0.2, 0)and then bound127.0.0.1on the same port. The kernel only guarantees the port is free on the address that was asked, so when another socket on the CI runner already held it on 127.0.0.1 the second bind raisedEADDRINUSE. The earlieris_port_available(port) is Falseassertion could also pass for the wrong reason in that case. It failed twice in a row on #4443, whose tested tree was byte-identical todev._hold_port_free_on_loopbacknow checks that 127.0.0.1 can bind the port while the other-address bind is held, and retries (up to 50) if not. Test-only change; no production code touched.Test plan
pytest tests/unit/test_ent1117_port_probe_bind_only.py: 6 passed (macOS)test_port_choice_skips_a_port_already_taken_on_loopbackgoes redis_port_availablebinding127.0.0.1instead of0.0.0.0: the wildcard test goes red, so the property it pins is still enforced127.0.0.2path runs in CI (pytest (head, seed 12345))Journey Impact: none: test-only fix to a unit test's port selection; no user journey changes
🤖 Generated with Claude Code