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
1 changed files with 17 additions and 6 deletions

View File

@ -23,6 +23,7 @@ import org.apache.hadoop.hdfs.protocol.ClientProtocol;
import org.apache.hadoop.net.MockDomainNameResolver; import org.apache.hadoop.net.MockDomainNameResolver;
import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.util.Time; import org.apache.hadoop.util.Time;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -292,12 +293,22 @@ public class TestConfiguredFailoverProxyProvider {
MockDomainNameResolver.FQDN_2 : "/" + MockDomainNameResolver.ADDR_2; MockDomainNameResolver.FQDN_2 : "/" + MockDomainNameResolver.ADDR_2;
// Check we got the proper addresses // Check we got the proper addresses
assertEquals(2, proxyResults.size()); assertEquals(2, proxyResults.size());
assertTrue( if (Shell.isJavaVersionAtLeast(14) && useFQDN) {
"nn1 wasn't returned: " + proxyResults, // JDK-8225499. The string format of unresolved address has been changed.
proxyResults.containsKey(resolvedHost1 + ":8020")); assertTrue(
assertTrue( "nn1 wasn't returned: " + proxyResults,
"nn2 wasn't returned: " + proxyResults, proxyResults.containsKey(resolvedHost1 + "/<unresolved>:8020"));
proxyResults.containsKey(resolvedHost2 + ":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 // Check that the Namenodes were invoked
assertEquals(NUM_ITERATIONS, nn1Count.get() + nn2Count.get()); assertEquals(NUM_ITERATIONS, nn1Count.get() + nn2Count.get());