zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eolive...@apache.org
Subject [zookeeper] branch branch-3.5.6 updated: ZOOKEEPER-3542: X509UtilTest#testClientRenegotiationFails is flaky on JDK8 + linux on machines with 2 cores
Date Sat, 14 Sep 2019 14:30:55 GMT
This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch branch-3.5.6
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.5.6 by this push:
     new f14f4b9  ZOOKEEPER-3542: X509UtilTest#testClientRenegotiationFails is flaky on JDK8
+ linux on machines with 2 cores
f14f4b9 is described below

commit f14f4b99ce5b6b791c81aed4b33957118491f56e
Author: Enrico Olivelli <eolivelli@apache.org>
AuthorDate: Sat Sep 14 16:30:30 2019 +0200

    ZOOKEEPER-3542: X509UtilTest#testClientRenegotiationFails is flaky on JDK8 + linux on
machines with 2 cores
    
    Author: Enrico Olivelli <eolivelli@apache.org>
    
    Reviewers: Norbert Kalmar <nkalmar@apache.org>
    
    Closes #1087 from eolivelli/fix/ZOOKEEPER-3542-35
    
    (cherry picked from commit 54de5f55ac75206088efd23239240214780f8bca)
    Signed-off-by: Enrico Olivelli <eolivelli@apache.org>
---
 .../src/test/java/org/apache/zookeeper/common/X509UtilTest.java      | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/common/X509UtilTest.java
b/zookeeper-server/src/test/java/org/apache/zookeeper/common/X509UtilTest.java
index 004b8df..6e35293 100644
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/common/X509UtilTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/common/X509UtilTest.java
@@ -25,10 +25,12 @@ import java.net.Socket;
 import java.security.Security;
 import java.util.Collection;
 import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.net.ssl.HandshakeCompletedEvent;
@@ -527,6 +529,7 @@ public class X509UtilTest extends BaseX509ParameterizedTestCase {
         SSLSocket clientSocket = null;
         SSLSocket serverSocket = null;
         final AtomicInteger handshakesCompleted = new AtomicInteger(0);
+        final CountDownLatch handshakeCompleted = new CountDownLatch(1);
         try {
             InetSocketAddress localServerAddress = new InetSocketAddress(
                     InetAddress.getLoopbackAddress(), port);
@@ -540,6 +543,7 @@ public class X509UtilTest extends BaseX509ParameterizedTestCase {
                         @Override
                         public void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent)
{
                             handshakesCompleted.getAndIncrement();
+                            handshakeCompleted.countDown();
                         }
                     });
                     Assert.assertEquals(1, sslSocket.getInputStream().read());
@@ -572,6 +576,7 @@ public class X509UtilTest extends BaseX509ParameterizedTestCase {
             workerPool.shutdown();
             // Make sure the first handshake completed and only the second
             // one failed.
+            handshakeCompleted.await(5, TimeUnit.SECONDS);
             Assert.assertEquals(1, handshakesCompleted.get());
         }
     }


Mime
View raw message