lianetm commented on code in PR #14346: URL: https://github.com/apache/kafka/pull/14346#discussion_r1322293224
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManagerTest.java: ########## @@ -455,6 +463,89 @@ public void testRequestFails_AuthenticationException() { assertEquals(0, requestManager.requestsToSend()); } + @Test + public void testResetPositionsSendNoRequestIfNoPartitionsNeedingReset() { + when(subscriptionState.partitionsNeedingReset(time.milliseconds())).thenReturn(Collections.emptySet()); + requestManager.resetPositionsIfNeeded(); + assertEquals(0, requestManager.requestsToSend()); + } + + @Test + public void testResetPositionsMissingLeader() { + expectFailedRequest_MissingLeader(); + when(subscriptionState.partitionsNeedingReset(time.milliseconds())).thenReturn(Collections.singleton(TEST_PARTITION_1)); + when(subscriptionState.resetStrategy(any())).thenReturn(OffsetResetStrategy.EARLIEST); + requestManager.resetPositionsIfNeeded(); + verify(metadata).requestUpdate(false); + assertEquals(0, requestManager.requestsToSend()); + } + + @Test + public void testResetPositionsSuccess_NoLeaderEpochInResponse() { + testResetPositionsSuccessWithLeaderEpoch(Metadata.LeaderAndEpoch.noLeaderOrEpoch()); + verify(metadata, never()).updateLastSeenEpochIfNewer(any(), anyInt()); + } + + @Test + public void testResetPositionsSuccess_LeaderEpochInResponse() { Review Comment: Done, added more unit tests, covering the validate positions -- 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