Bläddra i källkod

svn merge -c 1591030 FIXES: YARN-738. TestClientRMTokens is failing irregularly while running all yarn tests. Contributed by Ming Ma

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1591031 13f79535-47bb-0310-9956-ffa450edef68
Jason Darrell Lowe 11 år sedan
förälder
incheckning
413d84fabb

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -64,6 +64,9 @@ Release 2.5.0 - UNRELEASED
     YARN-1865. ShellScriptBuilder does not check for some error conditions.
     (Remus Rusanu via ivanmi)
 
+    YARN-738. TestClientRMTokens is failing irregularly while running all yarn
+    tests (Ming Ma via jlowe)
+
 Release 2.4.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 12 - 9
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java

@@ -36,6 +36,7 @@ import java.net.InetSocketAddress;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
 
+import org.apache.hadoop.net.NetUtils;
 import org.junit.Assert;
 
 import org.apache.commons.logging.Log;
@@ -235,8 +236,8 @@ public class TestClientRMTokens {
   @Test
   public void testShortCircuitRenewCancel()
       throws IOException, InterruptedException {
-    InetSocketAddress addr =
-        new InetSocketAddress(InetAddress.getLocalHost(), 123);
+    InetSocketAddress addr = NetUtils.createSocketAddr(
+        InetAddress.getLocalHost().getHostName(), 123, null);
     checkShortCircuitRenewCancel(addr, addr, true);
   }
 
@@ -244,17 +245,19 @@ public class TestClientRMTokens {
   public void testShortCircuitRenewCancelWildcardAddress()
       throws IOException, InterruptedException {
     InetSocketAddress rmAddr = new InetSocketAddress(123);
+    InetSocketAddress serviceAddr = NetUtils.createSocketAddr(
+        InetAddress.getLocalHost().getHostName(), rmAddr.getPort(), null);
     checkShortCircuitRenewCancel(
         rmAddr,
-        new InetSocketAddress(InetAddress.getLocalHost(), rmAddr.getPort()),
+        serviceAddr,
         true);
   }
 
   @Test
   public void testShortCircuitRenewCancelSameHostDifferentPort()
       throws IOException, InterruptedException {
-    InetSocketAddress rmAddr =
-        new InetSocketAddress(InetAddress.getLocalHost(), 123);    
+    InetSocketAddress rmAddr = NetUtils.createSocketAddr(
+        InetAddress.getLocalHost().getHostName(), 123, null);
     checkShortCircuitRenewCancel(
         rmAddr,
         new InetSocketAddress(rmAddr.getAddress(), rmAddr.getPort()+1),
@@ -264,8 +267,8 @@ public class TestClientRMTokens {
   @Test
   public void testShortCircuitRenewCancelDifferentHostSamePort()
       throws IOException, InterruptedException {
-    InetSocketAddress rmAddr =
-        new InetSocketAddress(InetAddress.getLocalHost(), 123);    
+    InetSocketAddress rmAddr = NetUtils.createSocketAddr(
+        InetAddress.getLocalHost().getHostName(), 123, null);
     checkShortCircuitRenewCancel(
         rmAddr,
         new InetSocketAddress("1.1.1.1", rmAddr.getPort()),
@@ -275,8 +278,8 @@ public class TestClientRMTokens {
   @Test
   public void testShortCircuitRenewCancelDifferentHostDifferentPort()
       throws IOException, InterruptedException {
-    InetSocketAddress rmAddr =
-        new InetSocketAddress(InetAddress.getLocalHost(), 123);    
+    InetSocketAddress rmAddr = NetUtils.createSocketAddr(
+        InetAddress.getLocalHost().getHostName(), 123, null);
     checkShortCircuitRenewCancel(
         rmAddr,
         new InetSocketAddress("1.1.1.1", rmAddr.getPort()+1),