Repository navigation
test(agent): let the system pick the UDP listener port - #59
Merged
Merged
Conversation
jvmTest and linuxX64Test run the same commonTest classes at the same time in one Gradle invocation, so the hardcoded 19317-19319 were shared by two processes and whichever bound second failed on a busy port. Bind port 0 and read the port back.
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.
UdpSenderTestbound its listeners on the hardcoded ports 19317–19319. The samecommonTestclasses run underjvmTestandlinuxX64Test, and in one Gradle invocation those two tasks run at the same time (org.gradle.parallel=true), so two processes shared three ports and whichever bound second failed. Whether it failed depended only on whether the two suites happened to overlap.The listener now binds port
0and reads the port back; the sender is pointed at that.Shown red before, green after
On a Linux x64 host, the native test binary filtered to
UdpSenderTestwas run 80 times in a loop while:agent:jvmTest --rerun --tests '*UdpSenderTest'ran three times beside it — the overlap the two Gradle tasks produce by chance, made certain:main(b2d268d)java.net.BindException: Address already in useAnd the plain form,
./gradlew :agent:jvmTest --rerun :agent:linuxX64Test --rerun :agent:ktlintCheck, three times on this branch: green 3 of 3 (18 native tests, all 6 jvm classes).The server has the same shape in
UdpReceiverTest(fixed 19313). That one is fixed together with #57, which changes howUdpReceivergets its socket and lets the test read the bound port back.