[
https://issues.apache.org/jira/browse/HDFS-17828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18020407#comment-18020407
]
ASF GitHub Bot commented on HDFS-17828:
---------------------------------------
stoty commented on code in PR #7955:
URL: https://github.com/apache/hadoop/pull/7955#discussion_r2348942795
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java:
##########
@@ -345,6 +356,33 @@ public static void assertExceptionContains(String
expectedText,
}
}
+ /**
+ * Assert that an exception's <code>toString()</code> value
+ * matches the pattern.
+ * @param pattern regex pattern to match
+ * @param t thrown exception
+ * @param message any extra text for the string
+ * @throws AssertionError if the expected string is not found
+ */
+ public static void assertExceptionMatches(Pattern pattern,
+ Throwable t,
Review Comment:
Same for the other suggestions.
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java:
##########
@@ -345,6 +356,33 @@ public static void assertExceptionContains(String
expectedText,
}
}
+ /**
+ * Assert that an exception's <code>toString()</code> value
+ * matches the pattern.
+ * @param pattern regex pattern to match
+ * @param t thrown exception
+ * @param message any extra text for the string
+ * @throws AssertionError if the expected string is not found
+ */
+ public static void assertExceptionMatches(Pattern pattern,
+ Throwable t,
Review Comment:
Thanks @steveloughran .
This method was cloned from assertExceptionContains.
I purposefully (and also out of lazyness) left it as close as possible to
assertExceptionContains().
While your suggested changes make sense, I think that there is more value in
keeping the implementations similar to each other.
> SocketTimeoutException not recognized in TestWebHdfsTimeouts with Java 24
> -------------------------------------------------------------------------
>
> Key: HDFS-17828
> URL: https://issues.apache.org/jira/browse/HDFS-17828
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs, test
> Affects Versions: 3.5.0
> Reporter: Istvan Toth
> Assignee: Istvan Toth
> Priority: Major
> Labels: java24, pull-request-available
>
> Java 24 capitalizes "Connect" in th Exception message, which the test does
> not recognize.
> {noformat}
> [ERROR]
> org.apache.hadoop.hdfs.web.TestWebHdfsTimeouts.testAuthUrlConnectTimeout(TimeoutSource)[2]
> -- Time elapsed: 0.313 s <<< FAILURE!
> java.lang.AssertionError:
> Expected to find 'localhost:33473: connect timed out' but got unexpected
> exception: java.net.SocketTimeoutException: localhost:33473: Connect timed out
> at
> java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:537)
> at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:583)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]