lianetm commented on code in PR #16043:
URL: https://github.com/apache/kafka/pull/16043#discussion_r1631389671
##########
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());
Review Comment:
we could simplify to a single `assertEquals` for event.error() and the
exception we mocked and expect here.
--
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]