philipnee commented on code in PR #16043:
URL: https://github.com/apache/kafka/pull/16043#discussion_r1631396237


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegateTest.java:
##########
@@ -169,14 +184,63 @@ public void testHasAnyPendingRequests() throws Exception {
         }
     }
 
+    @Test
+    public void testPropagateMetadataError() {
+        String exMsg = "Test Auth Exception";
+        doThrow(new 
AuthenticationException(exMsg)).when(metadata).maybeThrowAnyException();
+
+        LinkedList<BackgroundEvent> backgroundEventQueue = new LinkedList<>();
+        this.backgroundEventHandler = new 
BackgroundEventHandler(backgroundEventQueue);
+        NetworkClientDelegate networkClientDelegate = 
newNetworkClientDelegate();
+
+
+        assertEquals(0, backgroundEventQueue.size());
+        networkClientDelegate.poll(0, time.milliseconds());
+        assertEquals(1, backgroundEventQueue.size());
+
+        ErrorEvent event = (ErrorEvent) backgroundEventQueue.poll();
+        assertNotNull(event);
+        assertEquals(AuthenticationException.class, event.error().getClass());
+        assertEquals(exMsg, event.error().getMessage());
+    }
+
+    @Test
+    public void testPropagateInvalidTopicMetadataError() {
+        LinkedList<BackgroundEvent> backgroundEventQueue = new LinkedList<>();
+        this.backgroundEventHandler = new 
BackgroundEventHandler(backgroundEventQueue);
+        this.metadata = new Metadata(100, 100, 50000,

Review Comment:
   can we also use the mocked metadata as well?



-- 
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