HADOOP-17910. [JDK 17] TestNetUtils fails (#3481)

Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
Viraj Jasani 2021-09-27 06:42:47 +05:30 committed by GitHub
parent 1397cf2496
commit 9d44f503db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,8 @@
import org.apache.hadoop.security.NetUtilsTestResolver;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.test.LambdaTestUtils;
import org.apache.hadoop.util.Shell;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
@ -113,7 +115,12 @@ public void testInvalidAddress() throws Throwable {
fail("Should not have connected");
} catch (UnknownHostException uhe) {
LOG.info("Got exception: ", uhe);
GenericTestUtils.assertExceptionContains("invalid-test-host:0", uhe);
if (Shell.isJavaVersionAtLeast(17)) {
GenericTestUtils
.assertExceptionContains("invalid-test-host/<unresolved>:0", uhe);
} else {
GenericTestUtils.assertExceptionContains("invalid-test-host:0", uhe);
}
}
}