kirktrue commented on code in PR #17035:
URL: https://github.com/apache/kafka/pull/17035#discussion_r1776205457
##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetchRequestManagerTest.java:
##########
@@ -3387,6 +3394,71 @@ public void
testWhenFetchResponseReturnsALeaderShipChangeErrorAndNewLeaderInform
assertTrue(subscriptions.isFetchable(tp1));
}
+ @Test
+ public void testPollWithoutCreateFetchRequests() {
+ buildFetcher();
+
+ assignFromUser(singleton(tp0));
+ subscriptions.seek(tp0, 0);
+
+ assertEquals(0, sendFetches(false));
+ }
+
+ @Test
+ public void testPollWithCreateFetchRequests() {
+ buildFetcher();
+
+ assignFromUser(singleton(tp0));
+ subscriptions.seek(tp0, 0);
+
+ CompletableFuture<Void> future = fetcher.createFetchRequests();
+ assertNotNull(future);
+ assertFalse(future.isDone());
+
+ assertEquals(1, sendFetches(false));
+ assertTrue(future.isDone());
+
+ assertEquals(0, sendFetches(false));
+ }
+
+ @Test
+ public void testPollWithCreateFetchRequestsError() {
+ buildFetcher();
+
+ assignFromUser(singleton(tp0));
+ subscriptions.seek(tp0, 0);
+
+ fetcher.setAuthenticationException(new
AuthenticationException("Intentional error"));
+ CompletableFuture<Void> future = fetcher.createFetchRequests();
+ assertNotNull(future);
+ assertFalse(future.isDone());
+
+ assertDoesNotThrow(() -> sendFetches(false));
+ assertTrue(future.isCompletedExceptionally());
Review Comment:
Good suggestion!
--
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]