aiquestion commented on code in PR #12349: URL: https://github.com/apache/kafka/pull/12349#discussion_r926201391
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinatorTest.java: ########## @@ -1299,17 +1300,79 @@ public void testForceMetadataDeleteForPatternSubscriptionDuringRebalance() { } } + @Test + public void testOnJoinPrepareWithOffsetCommitShouldSuccessAfterRetry() { + try (ConsumerCoordinator coordinator = prepareCoordinatorForCloseTest(true, true, Optional.empty(), false)) { + int generationId = 42; + String memberId = "consumer-42"; + + Timer pollTimer = time.timer(100L); + client.prepareResponse(offsetCommitResponse(singletonMap(t1p, Errors.UNKNOWN_TOPIC_OR_PARTITION))); + boolean res = coordinator.onJoinPrepare(pollTimer, generationId, memberId); + assertFalse(res); + + pollTimer = time.timer(100L); + client.prepareResponse(offsetCommitResponse(singletonMap(t1p, Errors.NONE))); + res = coordinator.onJoinPrepare(pollTimer, generationId, memberId); + assertTrue(res); + + assertFalse(client.hasPendingResponses()); + assertFalse(client.hasInFlightRequests()); + assertFalse(coordinator.coordinatorUnknown()); + } + } + + @Test + public void testOnJoinPrepareWithOffsetCommitShouldKeepJoinAfterNonRetryableException() { + try (ConsumerCoordinator coordinator = prepareCoordinatorForCloseTest(true, true, Optional.empty(), false)) { + int generationId = 42; + String memberId = "consumer-42"; + + Timer pollTimer = time.timer(100L); + client.prepareResponse(offsetCommitResponse(singletonMap(t1p, Errors.UNKNOWN_MEMBER_ID))); + boolean res = coordinator.onJoinPrepare(pollTimer, generationId, memberId); + assertTrue(res); + + assertFalse(client.hasPendingResponses()); + assertFalse(client.hasInFlightRequests()); + assertFalse(coordinator.coordinatorUnknown()); + } + } + + @Test + public void testOnJoinPrepareWithOffsetCommitShouldKeepJoinAfterRebalanceTimeout() { + try (ConsumerCoordinator coordinator = prepareCoordinatorForCloseTest(true, true, Optional.empty(), false)) { + int generationId = 42; + String memberId = "consumer-42"; + + Timer pollTimer = time.timer(100L); + time.sleep(150); Review Comment: okay~ -- 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