This is an automated email from the ASF dual-hosted git repository. eolivelli pushed a commit to branch branch-3.5 in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/branch-3.5 by this push: new 54de5f5 ZOOKEEPER-3542: X509UtilTest#testClientRenegotiationFails is flaky on JDK8 + linux on machines with 2 cores 54de5f5 is described below commit 54de5f55ac75206088efd23239240214780f8bca Author: Enrico Olivelli <eolive...@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 <eolive...@apache.org> Reviewers: Norbert Kalmar <nkal...@apache.org> Closes #1087 from eolivelli/fix/ZOOKEEPER-3542-35 --- .../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()); } }