You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2022/03/08 18:10:59 UTC

[kafka] branch 3.1 updated: MINOR: Fix flaky test cases SocketServerTest.remoteCloseWithoutBufferedReceives and SocketServerTest.remoteCloseWithIncompleteBufferedReceive (#11861)

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

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


The following commit(s) were added to refs/heads/3.1 by this push:
     new 7802b45  MINOR: Fix flaky test cases SocketServerTest.remoteCloseWithoutBufferedReceives and SocketServerTest.remoteCloseWithIncompleteBufferedReceive (#11861)
7802b45 is described below

commit 7802b45cdde770f1409e6bc2a98f604b5fcdf2ee
Author: Vincent Jiang <84...@users.noreply.github.com>
AuthorDate: Tue Mar 8 10:03:11 2022 -0800

    MINOR: Fix flaky test cases SocketServerTest.remoteCloseWithoutBufferedReceives and SocketServerTest.remoteCloseWithIncompleteBufferedReceive (#11861)
    
    When a socket is closed, corresponding channel should be retained only if there is complete buffered requests.
    
    Reviewers: David Jacot <dj...@confluent.io>
---
 core/src/test/scala/unit/kafka/network/SocketServerTest.scala | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/src/test/scala/unit/kafka/network/SocketServerTest.scala b/core/src/test/scala/unit/kafka/network/SocketServerTest.scala
index af5631f..e992c9f 100644
--- a/core/src/test/scala/unit/kafka/network/SocketServerTest.scala
+++ b/core/src/test/scala/unit/kafka/network/SocketServerTest.scala
@@ -1512,7 +1512,9 @@ class SocketServerTest {
         // Step 3: Process the first request. Verify that the channel is not removed since the channel
         // should be retained to process buffered data.
         processRequestNoOpResponse(testableServer.dataPlaneRequestChannel, request1)
-        assertSame(channel, openOrClosingChannel(request1, testableServer).getOrElse(throw new IllegalStateException("Channel closed too early")))
+        if (numComplete > 0) {
+          assertSame(channel, openOrClosingChannel(request1, testableServer).getOrElse(throw new IllegalStateException("Channel closed too early")))
+        }
 
         // Step 4: Process buffered data. if `responseRequiredIndex>=0`, the channel should be failed and removed when
         // attempting to send response. Otherwise, the channel should be removed when all completed buffers are processed.