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/07 18:10:06 UTC

[kafka] branch trunk updated: KAFKA-7288 - Make sure no bytes buffered when relying on idle timeout in channel close test (#6390)

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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new 644ff6e  KAFKA-7288 - Make sure no bytes buffered when relying on idle timeout in channel close test (#6390)
644ff6e is described below

commit 644ff6e60f9ee7126cf02ee839610dab82037ac9
Author: Rajini Sivaram <ra...@googlemail.com>
AuthorDate: Thu Mar 7 18:09:50 2019 +0000

    KAFKA-7288 - Make sure no bytes buffered when relying on idle timeout in channel close test (#6390)
    
    SelectorTest.testCloseConnectionInClosingState sends and receives messages to get the channel into a state with staged receives and then waits for idle timeout to close the channel. When run with SSL, the channel may have buffered bytes that prevent the channel from being closed. Updated the test to wait until there are no buffered bytes as well.
    
    Reviewers: Ismael Juma <is...@juma.me.uk>
---
 .../src/test/java/org/apache/kafka/common/network/SelectorTest.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java b/clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java
index 2da1cc6..9d48ab5 100644
--- a/clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java
@@ -493,8 +493,10 @@ public class SelectorTest {
             do {
                 selector.poll(1000);
             } while (selector.completedReceives().isEmpty());
-        } while (selector.numStagedReceives(channel) == 0 && --retries > 0);
+        } while (selector.numStagedReceives(channel) == 0 && !channel.hasBytesBuffered() && --retries > 0);
         assertTrue("No staged receives after 100 attempts", selector.numStagedReceives(channel) > 0);
+        // We want to return without any bytes buffered to ensure that channel will be closed after idle time
+        assertFalse("Channel has bytes buffered", channel.hasBytesBuffered());
 
         return channel;
     }