Bind test servers to loopback address #585
Merged
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.
Binding to 0.0.0.0 is not guaranteed to result in a socket that is reachable via the loopback address, even when requesting an ephemeral port assignment by binding to port 0. It is possible for another process on the system to bind to the loopback address at that same port, and then client requests will go to that process instead of the test server, resulting in occasional cryptic test failures.
By instead binding to the loopback address specifically, rather than the wildcard address, we can prevent binding to a port that is already in use. This significantly improves the reliability of the test suite.