RivenSun2 commented on a change in pull request #11340: URL: https://github.com/apache/kafka/pull/11340#discussion_r776189676
########## File path: clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinatorTest.java ########## @@ -3202,17 +3202,18 @@ private void gracefulCloseTest(ConsumerCoordinator coordinator, boolean shouldLe OffsetCommitRequest commitRequest = (OffsetCommitRequest) body; return commitRequest.data().groupId().equals(groupId); }, new OffsetCommitResponse(new OffsetCommitResponseData())); + if (shouldLeaveGroup) Review comment: 1.Sure, `consumer.close(Duration.ZERO)` is also a solution. Thanks. My previous changes should not change the purpose of this test, and will not cause us to wait for the consumer to close forever. Because `autoCommit` is disabled, the `ConsumerCoordinator#close` method will end soon. Local verification is also performed, `testInvalidGroupMetadata` case can be passed quickly and successfully 2.The `gracefulCloseTest` method is only called by two testCases, `testCloseDynamicAssignment` and `testCloseManualAssignment`. `testCloseDynamicAssignment` uses the subscribe consumption model, `testCloseManualAssignment` uses the assign consumption model. The difference here is: when `coordinator.close()` is executed, `testCloseDynamicAssignment` will initiate a LeaveGroupRequest in the underlying `AbstractCoordinator#maybeLeaveGroup(String leaveReason)` method, but `testCloseManualAssignment` will not. So when I prepared `LeaveGroupResponse` here, I added a judgment on `shouldLeaveGroup`. The previous `gracefulCloseTest` code logic should prepare redundant `LeaveGroupResponse` for `testCloseManualAssignment`. -- 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