hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject git commit: MAPREDUCE-6125. TestContainerLauncherImpl sometimes fails. Contributed by Mit Desai
Date Mon, 13 Oct 2014 15:09:16 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk e8a31f2e1 -> bbe80cdc7


MAPREDUCE-6125. TestContainerLauncherImpl sometimes fails. Contributed by Mit Desai


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bbe80cdc
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bbe80cdc
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bbe80cdc

Branch: refs/heads/trunk
Commit: bbe80cdc7b37cae50e46eaa00e75240d4a2aac68
Parents: e8a31f2
Author: Jason Lowe <jlowe@apache.org>
Authored: Mon Oct 13 15:08:23 2014 +0000
Committer: Jason Lowe <jlowe@apache.org>
Committed: Mon Oct 13 15:08:23 2014 +0000

----------------------------------------------------------------------
 hadoop-mapreduce-project/CHANGES.txt            |  3 +++
 .../app/launcher/TestContainerLauncherImpl.java | 28 ++++++++++++++------
 2 files changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bbe80cdc/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt
index e7143c5..2b594be 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -423,6 +423,9 @@ Release 2.6.0 - UNRELEASED
     MAPREDUCE-5875. Make Counter limits consistent across JobClient, 
     MRAppMaster, and YarnChild. (Gera Shegalov via kasha)
 
+    MAPREDUCE-6125. TestContainerLauncherImpl sometimes fails (Mit Desai via
+    jlowe)
+
 Release 2.5.1 - 2014-09-05
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bbe80cdc/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java
index 4a69a7b..74e532a 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/launcher/TestContainerLauncherImpl.java
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.HashMap;
@@ -83,6 +84,13 @@ public class TestContainerLauncherImpl {
     serviceResponse.put(ShuffleHandler.MAPREDUCE_SHUFFLE_SERVICEID,
         ShuffleHandler.serializeMetaData(80));
   }
+
+  // tests here mock ContainerManagementProtocol which does not have close
+  // method. creating an interface that implements ContainerManagementProtocol
+  // and Closeable so the tests does not fail with NoSuchMethodException
+  private static interface ContainerManagementProtocolClient extends
+    ContainerManagementProtocol, Closeable {
+  }
   
   private static class ContainerLauncherImplUnderTest extends 
     ContainerLauncherImpl {
@@ -152,8 +160,8 @@ public class TestContainerLauncherImpl {
     EventHandler mockEventHandler = mock(EventHandler.class);
     when(mockContext.getEventHandler()).thenReturn(mockEventHandler);
     String cmAddress = "127.0.0.1:8000";
-    ContainerManagementProtocol mockCM =
-        mock(ContainerManagementProtocol.class);
+    ContainerManagementProtocolClient mockCM =
+        mock(ContainerManagementProtocolClient.class);
     ContainerLauncherImplUnderTest ut =
         new ContainerLauncherImplUnderTest(mockContext, mockCM);
     
@@ -213,8 +221,8 @@ public class TestContainerLauncherImpl {
     EventHandler mockEventHandler = mock(EventHandler.class);
     when(mockContext.getEventHandler()).thenReturn(mockEventHandler);
 
-    ContainerManagementProtocol mockCM =
-        mock(ContainerManagementProtocol.class);
+    ContainerManagementProtocolClient mockCM =
+        mock(ContainerManagementProtocolClient.class);
     ContainerLauncherImplUnderTest ut =
         new ContainerLauncherImplUnderTest(mockContext, mockCM);
     
@@ -275,8 +283,8 @@ public class TestContainerLauncherImpl {
     EventHandler mockEventHandler = mock(EventHandler.class);
     when(mockContext.getEventHandler()).thenReturn(mockEventHandler);
 
-    ContainerManagementProtocol mockCM =
-        mock(ContainerManagementProtocol.class);
+    ContainerManagementProtocolClient mockCM =
+        mock(ContainerManagementProtocolClient.class);
     ContainerLauncherImplUnderTest ut =
         new ContainerLauncherImplUnderTest(mockContext, mockCM);
 
@@ -330,7 +338,7 @@ public class TestContainerLauncherImpl {
     EventHandler mockEventHandler = mock(EventHandler.class);
     when(mockContext.getEventHandler()).thenReturn(mockEventHandler);
 
-    ContainerManagementProtocol mockCM =
+    ContainerManagementProtocolClient mockCM =
         new ContainerManagerForTest(startLaunchBarrier, completeLaunchBarrier);
     ContainerLauncherImplUnderTest ut =
         new ContainerLauncherImplUnderTest(mockContext, mockCM);
@@ -406,7 +414,7 @@ public class TestContainerLauncherImpl {
         currentTime + 10000L, 123, currentTime, Priority.newInstance(0), 0));
   }
 
-  private static class ContainerManagerForTest implements ContainerManagementProtocol {
+  private static class ContainerManagerForTest implements ContainerManagementProtocolClient
{
 
     private CyclicBarrier startLaunchBarrier;
     private CyclicBarrier completeLaunchBarrier;
@@ -444,6 +452,10 @@ public class TestContainerLauncherImpl {
         GetContainerStatusesRequest request) throws IOException {
       return null;
     }
+
+    @Override
+    public void close() throws IOException {
+    }
   }
   
   @SuppressWarnings("serial")


Mime
View raw message