dajac commented on code in PR #14321: URL: https://github.com/apache/kafka/pull/14321#discussion_r1314671160
########## group-coordinator/src/test/java/org/apache/kafka/coordinator/group/consumer/ConsumerGroupTest.java: ########## @@ -631,4 +631,33 @@ public void testValidateOffsetCommit() { // This should succeed. group.validateOffsetCommit("member-id", "", 0); } + + @Test + public void testValidateOffsetFetch() { + SnapshotRegistry snapshotRegistry = new SnapshotRegistry(new LogContext()); + ConsumerGroup group = new ConsumerGroup(snapshotRegistry, "group-foo"); + + // Simulate a call from the admin client without member id and member epoch. + // This should pass only if the group is empty. + group.validateOffsetFetch("", -1, Long.MAX_VALUE); + + // The member does not exist. + assertThrows(UnknownMemberIdException.class, () -> + group.validateOffsetFetch("member-id", 0, Long.MAX_VALUE)); + + // Create a member. + snapshotRegistry.getOrCreateSnapshot(0); + group.getOrMaybeCreateMember("member-id", true); + + // The member does not exist at epoch 0. Review Comment: This comment is confusing. The epoch was referring to the epoch of the snapshot here. I rephrased it to make it clearer. -- 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