This is an automated email from the ASF dual-hosted git repository.
nkalmar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/master by this push:
new d6900bf ZOOKEEPER-3542: X509UtilTest#testClientRenegotiationFails is
flaky on JDK8 + linux on machines with 2 cores
d6900bf is described below
commit d6900bf253dd613f1149b3f885b78a679f11b249
Author: Enrico Olivelli <[email protected]>
AuthorDate: Wed Sep 18 16:03:37 2019 +0200
ZOOKEEPER-3542: X509UtilTest#testClientRenegotiationFails is flaky on JDK8
+ linux on machines with 2 cores
Author: Enrico Olivelli <[email protected]>
Reviewers: Norbert Kalmar <[email protected]>
Closes #1088 from eolivelli/fix/ZOOKEEPER-3542-master
---
.../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 d22b2f1..05d216b 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
@@ -31,10 +31,12 @@ import java.security.NoSuchAlgorithmException;
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 java.util.function.Supplier;
import javax.net.ssl.HandshakeCompletedEvent;
@@ -538,6 +540,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);
listeningSocket.bind(localServerAddress);
@@ -550,6 +553,7 @@ public class X509UtilTest extends
BaseX509ParameterizedTestCase {
@Override
public void handshakeCompleted(HandshakeCompletedEvent
handshakeCompletedEvent) {
handshakesCompleted.getAndIncrement();
+ handshakeCompleted.countDown();
}
});
assertEquals(1, sslSocket.getInputStream().read());
@@ -582,6 +586,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);
assertEquals(1, handshakesCompleted.get());
}
}