You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by rb...@apache.org on 2015/06/02 04:15:07 UTC

tez git commit: TEZ-2506. TestAysncHttpConnection failing (rbalamohan)

Repository: tez
Updated Branches:
  refs/heads/master 7fe0a6b71 -> 4c48283ee


TEZ-2506. TestAysncHttpConnection failing (rbalamohan)


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

Branch: refs/heads/master
Commit: 4c48283eedb75b0105f236735bcd430bbbafc644
Parents: 7fe0a6b
Author: Rajesh Balamohan <rb...@apache.org>
Authored: Tue Jun 2 07:45:39 2015 +0530
Committer: Rajesh Balamohan <rb...@apache.org>
Committed: Tue Jun 2 07:45:39 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                          |  1 +
 .../java/org/apache/tez/http/TestHttpConnection.java | 15 +++++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/4c48283e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c1a7b09..116a387 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,7 @@ INCOMPATIBLE CHANGES
   TEZ-2468. Change the minimum Java version to Java 7.
 
 ALL CHANGES:
+  TEZ-2506. TestAysncHttpConnection failing.
   TEZ-2503. findbugs version isn't reported properly in test-patch report.
   TEZ-2198. Fix sorter spill counts.
   TEZ-1883. Change findbugs version to 3.x.

http://git-wip-us.apache.org/repos/asf/tez/blob/4c48283e/tez-runtime-library/src/test/java/org/apache/tez/http/TestHttpConnection.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/http/TestHttpConnection.java b/tez-runtime-library/src/test/java/org/apache/tez/http/TestHttpConnection.java
index 8f0a7ad..8b07d5a 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/http/TestHttpConnection.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/http/TestHttpConnection.java
@@ -28,6 +28,7 @@ import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
 import java.io.IOException;
+import java.net.ConnectException;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.channels.ClosedByInterruptException;
@@ -124,8 +125,8 @@ public class TestHttpConnection {
         wait(100);
       }
     }
-
     assertTrue("currentThread is still null", currentThread != null);
+    Thread.sleep(1000); //To avoid race to interrupt the thread before connect()
 
     //Try interrupting the thread (exception verification happens in the worker itself)
     currentThread.interrupt();
@@ -186,9 +187,15 @@ public class TestHttpConnection {
         fail();
       } catch(Throwable t) {
         if (expectingInterrupt) {
-          //ClosedByInterruptException normally; InterruptedException if
-          // TezBodyDeferringAsyncHandler quits otherwise
-          assertTrue((t instanceof InterruptedException) || (t instanceof ClosedByInterruptException));
+          if (t instanceof ConnectException) {
+            //ClosedByInterruptException via NettyConnectListener.operationComplete()
+            assertTrue("Expected ClosedByInterruptException, received "
+                    + Throwables.getStackTraceAsString(t.getCause()),
+                t.getCause() instanceof ClosedByInterruptException);
+          } else {
+            // InterruptedException if TezBodyDeferringAsyncHandler quits
+            assertTrue(t instanceof InterruptedException);
+          }
         }
       } finally {
         latch.countDown();