You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by rs...@apache.org on 2019/03/06 17:45:10 UTC

[kafka] branch 2.2 updated: KAFKA-8038 - Fix timing issue in SslTransportLayerTest.testCloseSsl (#6377)

This is an automated email from the ASF dual-hosted git repository.

rsivaram pushed a commit to branch 2.2
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.2 by this push:
     new 5653989  KAFKA-8038 - Fix timing issue in SslTransportLayerTest.testCloseSsl (#6377)
5653989 is described below

commit 5653989d12cf875cf4189fd89f0737b74c61d26f
Author: Rajini Sivaram <ra...@googlemail.com>
AuthorDate: Wed Mar 6 17:33:26 2019 +0000

    KAFKA-8038 - Fix timing issue in SslTransportLayerTest.testCloseSsl (#6377)
    
    Ensure that server-side channel is ready before it is muted in the test.
    
    Reviewers: Ismael Juma <is...@juma.me.uk>
---
 .../java/org/apache/kafka/common/network/SslTransportLayerTest.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/clients/src/test/java/org/apache/kafka/common/network/SslTransportLayerTest.java b/clients/src/test/java/org/apache/kafka/common/network/SslTransportLayerTest.java
index 80b24b8..118baec 100644
--- a/clients/src/test/java/org/apache/kafka/common/network/SslTransportLayerTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/network/SslTransportLayerTest.java
@@ -860,6 +860,11 @@ public class SslTransportLayerTest {
         selector.connect(node, addr, BUFFER_SIZE, BUFFER_SIZE);
 
         NetworkTestUtils.waitForChannelReady(selector, node);
+        // `waitForChannelReady` waits for client-side channel to be ready. This is sufficient for other tests
+        // operating on the client-side channel. But here, we are muting the server-side channel below, so we
+        // need to wait for the server-side channel to be ready as well.
+        TestUtils.waitForCondition(() -> server.selector().channels().stream().allMatch(KafkaChannel::ready),
+                "Channel not ready");
 
         final ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
         server.outputChannel(Channels.newChannel(bytesOut));