lianetm commented on code in PR #19886:
URL: https://github.com/apache/kafka/pull/19886#discussion_r2535646803


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegateTest.java:
##########
@@ -282,6 +283,51 @@ public void testRecordUnsentRequestsQueueTime(String 
groupName) throws Exception
         }
     }
 
+    @Test
+    public void testPollWithOnClose() throws Exception {
+        try (NetworkClientDelegate ncd = newNetworkClientDelegate(false)) {
+            NetworkClientDelegate.UnsentRequest unsentRequest = 
newUnsentFindCoordinatorRequest();
+            ncd.add(unsentRequest);
+
+            // First poll without onClose
+            ncd.poll(0, time.milliseconds());
+            assertTrue(ncd.hasAnyPendingRequests());
+
+            // Poll with onClose=true
+            ncd.poll(0, time.milliseconds(), true);
+            assertTrue(ncd.hasAnyPendingRequests());
+
+            // Complete the request
+            
client.respond(FindCoordinatorResponse.prepareResponse(Errors.NONE, GROUP_ID, 
mockNode()));
+            ncd.poll(0, time.milliseconds(), true);
+            assertFalse(ncd.hasAnyPendingRequests());
+        }
+    }
+
+    @Test
+    public void testCheckDisconnectsWithOnClose() throws Exception {
+        try (NetworkClientDelegate ncd = newNetworkClientDelegate(false)) {
+            NetworkClientDelegate.UnsentRequest unsentRequest = 
newUnsentFindCoordinatorRequest();
+            ncd.add(unsentRequest);
+
+            // Mark node as disconnected
+            Node node = mockNode();
+            client.setUnreachable(node, REQUEST_TIMEOUT_MS);
+
+            // Poll with onClose=false
+            ncd.poll(0, time.milliseconds(), false);

Review Comment:
   I would suggest we remove the `false` param here, so that we use the main 
call to `poll()` (that is supposed to pass false internally)
   
   It's an important coverage I don't see we have right? It would be a nasty 
regression if we make the main poll use onClose true by mistake (could start to 
silently drop requests on node failures I imagine) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to