From b57f04cd5bffe4efa5dbee524f619864b05669c7 Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Tue, 17 Nov 2020 10:56:56 +0900 Subject: [PATCH] HDFS-15685. [JDK 14] TestConfiguredFailoverProxyProvider#testResolveDomainNameUsingDNS fails. (#2465) --- .../TestConfiguredFailoverProxyProvider.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestConfiguredFailoverProxyProvider.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestConfiguredFailoverProxyProvider.java index e3f34e3c66..f28bfa65b5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestConfiguredFailoverProxyProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestConfiguredFailoverProxyProvider.java @@ -23,6 +23,7 @@ import org.apache.hadoop.net.MockDomainNameResolver; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.test.GenericTestUtils; +import org.apache.hadoop.util.Shell; import org.apache.hadoop.util.Time; import org.junit.Before; import org.junit.BeforeClass; @@ -292,12 +293,22 @@ private void testResolveDomainNameUsingDNS(boolean useFQDN) throws Exception { MockDomainNameResolver.FQDN_2 : "/" + MockDomainNameResolver.ADDR_2; // Check we got the proper addresses assertEquals(2, proxyResults.size()); - assertTrue( - "nn1 wasn't returned: " + proxyResults, - proxyResults.containsKey(resolvedHost1 + ":8020")); - assertTrue( - "nn2 wasn't returned: " + proxyResults, - proxyResults.containsKey(resolvedHost2 + ":8020")); + if (Shell.isJavaVersionAtLeast(14) && useFQDN) { + // JDK-8225499. The string format of unresolved address has been changed. + assertTrue( + "nn1 wasn't returned: " + proxyResults, + proxyResults.containsKey(resolvedHost1 + "/:8020")); + assertTrue( + "nn2 wasn't returned: " + proxyResults, + proxyResults.containsKey(resolvedHost2 + "/:8020")); + } else { + assertTrue( + "nn1 wasn't returned: " + proxyResults, + proxyResults.containsKey(resolvedHost1 + ":8020")); + assertTrue( + "nn2 wasn't returned: " + proxyResults, + proxyResults.containsKey(resolvedHost2 + ":8020")); + } // Check that the Namenodes were invoked assertEquals(NUM_ITERATIONS, nn1Count.get() + nn2Count.get());