HDFS-15685. [JDK 14] TestConfiguredFailoverProxyProvider#testResolveDomainNameUsingDNS fails. (#2465)

(cherry picked from commit b57f04cd5b)
This commit is contained in:
Akira Ajisaka 2020-11-17 10:56:56 +09:00
parent df4edb99f7
commit be108159b1
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50

View File

@ -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());
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 + "/<unresolved>:8020"));
assertTrue(
"nn2 wasn't returned: " + proxyResults,
proxyResults.containsKey(resolvedHost2 + "/<unresolved>: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());