avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [31/35] avro git commit: AVRO-1943 - Flaky test: TestNettyServerWithCompression.testConnectionsCount
Date Sat, 05 Nov 2016 20:20:48 GMT
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/30f90d12
Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/30f90d12
Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/30f90d12

Branch: refs/heads/branch-1.8
Commit: 30f90d1237060171f9909d0696bd0bb0d0b8c719
Parents: b2a2256
Author: Gabor Szadovszky <gabor.szadovszky@cloudera.com>
Authored: Wed Oct 26 14:42:39 2016 +0200
Committer: Ryan Blue <blue@apache.org>
Committed: Sat Nov 5 13:19:07 2016 -0700

----------------------------------------------------------------------
 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/30f90d12/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1394d70..44605eb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -84,6 +84,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/30f90d12/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