You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cn...@apache.org on 2025/03/20 22:56:28 UTC
(hadoop) branch trunk updated: HADOOP-19499. Handle JDK-8225499 IpAddr.toString() format changes in tests
This is an automated email from the ASF dual-hosted git repository.
cnauroth pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new af6a64f7631 HADOOP-19499. Handle JDK-8225499 IpAddr.toString() format changes in tests
af6a64f7631 is described below
commit af6a64f7631a25674fdcffcea763c3ba4a2e40cc
Author: Istvan Toth <st...@apache.org>
AuthorDate: Thu Mar 20 22:54:50 2025 +0000
HADOOP-19499. Handle JDK-8225499 IpAddr.toString() format changes in tests
Closes #7502
Signed-off-by: Chris Nauroth <cn...@apache.org>
---
.../router/TestRouterNamenodeHeartbeat.java | 41 +++++++++++++------
.../mapreduce/v2/app/TestJobEndNotifier.java | 47 +++++++++++++++-------
2 files changed, 62 insertions(+), 26 deletions(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterNamenodeHeartbeat.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterNamenodeHeartbeat.java
index bb284c49ce3..18718158724 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterNamenodeHeartbeat.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterNamenodeHeartbeat.java
@@ -48,6 +48,7 @@
import org.apache.hadoop.net.MockDomainNameResolver;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.service.Service.STATE;
+import org.apache.hadoop.util.Shell;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
@@ -216,18 +217,34 @@ public void testHearbeat() throws InterruptedException, IOException {
@Test
public void testNamenodeHeartbeatServiceHAServiceProtocolProxy(){
- testNamenodeHeartbeatServiceHAServiceProtocol(
- "test-ns", "nn", 1000, -1, -1, 1003,
- "host01.test:1000", "host02.test:1000");
- testNamenodeHeartbeatServiceHAServiceProtocol(
- "test-ns", "nn", 1000, 1001, -1, 1003,
- "host01.test:1001", "host02.test:1001");
- testNamenodeHeartbeatServiceHAServiceProtocol(
- "test-ns", "nn", 1000, -1, 1002, 1003,
- "host01.test:1002", "host02.test:1002");
- testNamenodeHeartbeatServiceHAServiceProtocol(
- "test-ns", "nn", 1000, 1001, 1002, 1003,
- "host01.test:1002", "host02.test:1002");
+ // JDK-8225499. The string format of unresolved address has been changed.
+ if (Shell.isJavaVersionAtLeast(14)) {
+ testNamenodeHeartbeatServiceHAServiceProtocol(
+ "test-ns", "nn", 1000, -1, -1, 1003,
+ "host01.test/<unresolved>:1000", "host02.test/<unresolved>:1000");
+ testNamenodeHeartbeatServiceHAServiceProtocol(
+ "test-ns", "nn", 1000, 1001, -1, 1003,
+ "host01.test/<unresolved>:1001", "host02.test/<unresolved>:1001");
+ testNamenodeHeartbeatServiceHAServiceProtocol(
+ "test-ns", "nn", 1000, -1, 1002, 1003,
+ "host01.test/<unresolved>:1002", "host02.test/<unresolved>:1002");
+ testNamenodeHeartbeatServiceHAServiceProtocol(
+ "test-ns", "nn", 1000, 1001, 1002, 1003,
+ "host01.test/<unresolved>:1002", "host02.test/<unresolved>:1002");
+ } else {
+ testNamenodeHeartbeatServiceHAServiceProtocol(
+ "test-ns", "nn", 1000, -1, -1, 1003,
+ "host01.test:1000", "host02.test:1000");
+ testNamenodeHeartbeatServiceHAServiceProtocol(
+ "test-ns", "nn", 1000, 1001, -1, 1003,
+ "host01.test:1001", "host02.test:1001");
+ testNamenodeHeartbeatServiceHAServiceProtocol(
+ "test-ns", "nn", 1000, -1, 1002, 1003,
+ "host01.test:1002", "host02.test:1002");
+ testNamenodeHeartbeatServiceHAServiceProtocol(
+ "test-ns", "nn", 1000, 1001, 1002, 1003,
+ "host01.test:1002", "host02.test:1002");
+ }
}
private void testNamenodeHeartbeatServiceHAServiceProtocol(
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestJobEndNotifier.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestJobEndNotifier.java
index b2af290d9bb..f8fefd8fe6d 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestJobEndNotifier.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestJobEndNotifier.java
@@ -61,6 +61,7 @@
import org.apache.hadoop.mapreduce.v2.app.rm.ContainerAllocatorEvent;
import org.apache.hadoop.mapreduce.v2.app.rm.RMCommunicator;
import org.apache.hadoop.mapreduce.v2.app.rm.RMHeartbeatHandler;
+import org.apache.hadoop.util.Shell;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.junit.jupiter.api.Test;
@@ -124,20 +125,38 @@ private void testProxyConfiguration(Configuration conf) {
"Proxy shouldn't be set because port wasn't numeric");
conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "somehost:1000");
setConf(conf);
- assertEquals("HTTP @ somehost:1000", proxyToUse.toString(),
- "Proxy should have been set but wasn't ");
- conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "socks@somehost:1000");
- setConf(conf);
- assertEquals("SOCKS @ somehost:1000", proxyToUse.toString(),
- "Proxy should have been socks but wasn't ");
- conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "SOCKS@somehost:1000");
- setConf(conf);
- assertEquals("SOCKS @ somehost:1000", proxyToUse.toString(),
- "Proxy should have been socks but wasn't ");
- conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "sfafn@somehost:1000");
- setConf(conf);
- assertEquals("HTTP @ somehost:1000", proxyToUse.toString(),
- "Proxy should have been http but wasn't ");
+ // JDK-8225499. The string format of unresolved address has been changed.
+ if (Shell.isJavaVersionAtLeast(14)) {
+ assertEquals("HTTP @ somehost/<unresolved>:1000", proxyToUse.toString(),
+ "Proxy should have been set but wasn't ");
+ conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "socks@somehost:1000");
+ setConf(conf);
+ assertEquals("SOCKS @ somehost/<unresolved>:1000", proxyToUse.toString(),
+ "Proxy should have been socks but wasn't ");
+ conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "SOCKS@somehost:1000");
+ setConf(conf);
+ assertEquals("SOCKS @ somehost/<unresolved>:1000", proxyToUse.toString(),
+ "Proxy should have been socks but wasn't ");
+ conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "sfafn@somehost:1000");
+ setConf(conf);
+ assertEquals("HTTP @ somehost/<unresolved>:1000", proxyToUse.toString(),
+ "Proxy should have been http but wasn't ");
+ } else {
+ assertEquals("HTTP @ somehost:1000", proxyToUse.toString(),
+ "Proxy should have been set but wasn't ");
+ conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "socks@somehost:1000");
+ setConf(conf);
+ assertEquals("SOCKS @ somehost:1000", proxyToUse.toString(),
+ "Proxy should have been socks but wasn't ");
+ conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "SOCKS@somehost:1000");
+ setConf(conf);
+ assertEquals("SOCKS @ somehost:1000", proxyToUse.toString(),
+ "Proxy should have been socks but wasn't ");
+ conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "sfafn@somehost:1000");
+ setConf(conf);
+ assertEquals("HTTP @ somehost:1000", proxyToUse.toString(),
+ "Proxy should have been http but wasn't ");
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org