lianetm commented on code in PR #16043: URL: https://github.com/apache/kafka/pull/16043#discussion_r1631395106
########## 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() { Review Comment: this tests seems to be testing exactly the same as `testPropagateMetadataError`, but generating the error differently (error generation is logic that belongs to the Metadata class, not this one, that's why we end up having to create a metadata object and not a mock). I could be missing something but seems to me we should remove this one, and just keep the one above that ensures that the error propagation we're responsible for here happens as expected (no matter how the error made it to the metadata object). Makes sense? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org