Repository navigation
[CI] Check the exception type in the timeout tests, not its message - #43
Merged
Merged
Conversation
On Java 8 a 1 ms connect timeout can run out before the connection attempt starts: SocksSocketImpl asks the proxy selector in between and then throws a SocketTimeoutException without a message, on which testConnectTimeout called toLowerCase(). Both tests now check for a SocketTimeoutException. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
testConnectTimeoutfails now and then on Java 8. In this run of #35 the Java 8 job failed twice with aNullPointerExceptionatLogtailAppenderTimeoutTest.java:44and passed on its third attempt, so the build's retries hid it.The test sets a 1 ms connect timeout against a non-routable address and compared the exception's message with "connect timed out". On Java 8,
HttpURLConnectionconnects throughSocksSocketImpl, which asks the proxy selector between starting the clock and the connection attempt. When the time is up by then, it throws aSocketTimeoutExceptionwithout a message, and the test calledtoLowerCase()onnull. On Java 11, 17 and 21 the connection does not go throughSocksSocketImpland the message is always there.Both tests of the class now check that the exception is a
SocketTimeoutException. What tells a connect timeout from a read timeout is the endpoint each test uses: the non-routable address never gets as far as reading, and the local socket that accepts and never answers connects at once.Run in a fresh JVM each time on Java 8 (Temurin in Docker):
NullPointerException. Now 60 of 60 pass, 5 of them with the exception that has no message.The failure is intermittent, so this comes without a failing-tests-first commit.
🤖 Generated with Claude Code