Repository navigation
test: keep other programs off the IPv4 port of the socket tests of a server on ::1 only - #2043
Merged
lagergren merged 1 commit intoNov 21, 2026
Conversation
…server on ::1 only Two tests of `SocketStreamConnectionProviderTest` have the race that redhat-developer#2035 removes from `DAPLoopbackConnectionTest`. They listen on a port of `::1` that the system picks, and expect nothing on the same port of `127.0.0.1`: - `testWithoutAHostItReachesALanguageServerWhichListensOnTheIPv6LoopbackAddressOnly` expects a provider without a host to fall through to `::1`. With another program on that port of `127.0.0.1`, the provider connects there, and the test waits for a connection to its server that never comes; - `testAnIPv4AddressAsTheHostIsNotTriedOverIPv6` expects the connection to `127.0.0.1` to be refused, and it is accepted. `IPv6OnlyLoopbackPort` listens on a port of `::1` and binds the same port of `127.0.0.1` with a socket that doesn't listen, and takes another port when it is in use there, as redhat-developer#2035 does. While it is bound, nothing else can listen there. Its server's accept times out after 10 seconds rather than hang a test. Test: `SocketStreamConnectionProviderTest` passes on a default JVM and on one that prefers IPv6 addresses (29 tests).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2043 +/- ##
==========================================
- Coverage 49.44% 49.40% -0.04%
==========================================
Files 813 813
Lines 33324 33324
Branches 5191 5191
==========================================
- Hits 16478 16465 -13
- Misses 14272 14282 +10
- Partials 2574 2577 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
@coderabbitai review |
Action not completed
|
Collaborator
Author
|
@coderabbitai review |
Action performed
|
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.
Two tests of
SocketStreamConnectionProviderTesthave the race that#2035 removes from
DAPLoopbackConnectionTest. They listen on a port of::1that the system picks, and expect nothing on the same port of127.0.0.1:testWithoutAHostItReachesALanguageServerWhichListensOnTheIPv6LoopbackAddressOnlyexpects a provider without a host to fall through to
::1. Withanother program on that port of
127.0.0.1, the provider connectsthere, and the test waits for a connection to its server that never
comes;
testAnIPv4AddressAsTheHostIsNotTriedOverIPv6expects the connectionto
127.0.0.1to be refused, and it is accepted.IPv6OnlyLoopbackPortlistens on a port of::1and binds the same portof
127.0.0.1with a socket that doesn't listen, and takes another portwhen it is in use there, as #2035 does. While it is bound, nothing else
can listen there. Its server's accept times out after 10 seconds rather
than hang a test.
Test:
SocketStreamConnectionProviderTestpasses on a default JVM and onone that prefers IPv6 addresses (30 tests).
DAPLoopbackConnectionTestkeeps its own copy of the helper in #2035, which is still open; once both are merged, it can useIPv6OnlyLoopbackPorttoo.