frankvicky commented on code in PR #16833: URL: https://github.com/apache/kafka/pull/16833#discussion_r1713744086
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/CommitRequestManagerTest.java: ########## @@ -1200,13 +1198,23 @@ private void completeOffsetCommitRequestWithError(CommitRequestManager commitReq } private void testRetriable(final CommitRequestManager commitRequestManager, - final List<CompletableFuture<Map<TopicPartition, OffsetAndMetadata>>> futures) { + final List<CompletableFuture<Map<TopicPartition, OffsetAndMetadata>>> futures, + final Errors error + ) { futures.forEach(f -> assertFalse(f.isDone())); - // The manager should backoff for 100ms - time.sleep(100); - commitRequestManager.poll(time.milliseconds()); + // The manager should backoff before retry + time.sleep(retryBackoffMs); + NetworkClientDelegate.PollResult poll = commitRequestManager.poll(time.milliseconds()); + assertEquals(1, poll.unsentRequests.size()); futures.forEach(f -> assertFalse(f.isDone())); + poll.unsentRequests.get(0).handler().onComplete(buildOffsetFetchClientResponse(poll.unsentRequests.get(0), new HashSet<>(), error)); + + // Sleep util timeout + time.sleep(defaultApiTimeoutMs); + poll = commitRequestManager.poll(time.milliseconds()); + assertEquals(1, poll.unsentRequests.size()); + futures.forEach(f -> assertTrue(f.isCompletedExceptionally())); Review Comment: Thanks for pointing out, I will utilize `assertFutureThrows` to achieve that. :smile: -- 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