avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject avro git commit: AVRO-1943 - Flaky test: TestNettyServerWithCompression.testConnectionsCount
Date Mon, 31 Oct 2016 11:07:51 GMT
Repository: avro
Updated Branches:
  refs/heads/master 420824c13 -> e2d1073bf


AVRO-1943 - Flaky test: TestNettyServerWithCompression.testConnectionsCount


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

Branch: refs/heads/master
Commit: e2d1073bf5095af38fc6ed194d92fc82de225fc9
Parents: 420824c
Author: Gabor Szadovszky <gabor.szadovszky@cloudera.com>
Authored: Wed Oct 26 14:42:39 2016 +0200
Committer: Tom White <tom@cloudera.com>
Committed: Mon Oct 31 11:07:06 2016 +0000

----------------------------------------------------------------------
 CHANGES.txt                                           |  4 ++++
 .../java/org/apache/avro/ipc/TestNettyServer.java     | 14 +++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/avro/blob/e2d1073b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ac2eff9..45b0f61 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -87,6 +87,10 @@ Trunk (not yet released)
     AVRO-1882: Java: Fix ConcurrentHashMap with non-string keys.
     (Sachin Goyal via blue)
 
+    AVRO-1943: Java: Flaky test:
+    TestNettyServerWithCompression.testConnectionsCount
+    (Gabor Szadovszky via tomwhite)
+
 Avro 1.8.1 (14 May 2016)
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/avro/blob/e2d1073b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServer.java
----------------------------------------------------------------------
diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServer.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServer.java
index 14981c3..cf02bad 100644
--- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServer.java
+++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServer.java
@@ -24,12 +24,11 @@ import static org.junit.Assert.assertEquals;
 
 import java.net.InetSocketAddress;
 import java.net.Socket;
-import java.net.UnknownHostException;
 import java.nio.charset.Charset;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import junit.framework.Assert;
+import org.junit.Assert;
 
 import org.apache.avro.ipc.specific.SpecificRequestor;
 import org.apache.avro.ipc.specific.SpecificResponder;
@@ -149,7 +148,16 @@ public class TestNettyServer {
     proxy2.fireandforget(createMessage());
     Assert.assertEquals(2, ((NettyServer) server).getNumActiveConnections());
     transceiver2.close();
-    Assert.assertEquals(1, ((NettyServer) server).getNumActiveConnections());
+
+    // Check the active connections with some retries as closing at the client
+    // side might not take effect on the server side immediately
+    int numActiveConnections = ((NettyServer) server).getNumActiveConnections();
+    for (int i = 0; i < 50 && numActiveConnections == 2; ++i) {
+      System.out.println("Server still has 2 active connections; retrying...");
+      Thread.sleep(100);
+      numActiveConnections = ((NettyServer) server).getNumActiveConnections();
+    }
+    Assert.assertEquals(1, numActiveConnections);
   }
 
   private Message createMessage() {


Mime
View raw message