jolshan commented on code in PR #14067:
URL: https://github.com/apache/kafka/pull/14067#discussion_r1274227661


##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/generic/GenericGroupTest.java:
##########
@@ -956,6 +961,72 @@ public void testMaybeElectNewJoinedLeaderChooseExisting() {
         assertTrue(group.isLeader(memberId));
     }
 
+    @Test
+    public void testValidateOffsetCommit() {
+        // A call from the admin client without any parameters should pass.
+        group.validateOffsetCommit("", "", -1);
+
+        // Add a member.
+        group.add(new GenericGroupMember(
+            "member-id",
+            Optional.of("instance-id"),
+            "",
+            "",
+            100,
+            100,
+            "consumer",
+            new JoinGroupRequestProtocolCollection(Collections.singletonList(
+                new JoinGroupRequestProtocol()
+                    .setName("roundrobin")
+                    .setMetadata(new byte[0])).iterator())
+        ));
+
+        group.transitionTo(PREPARING_REBALANCE);
+        group.initNextGeneration();
+
+        // No parameters and the group is not empty.
+        assertThrows(UnknownMemberIdException.class,
+            () -> group.validateOffsetCommit("", "", -1));
+
+        // The member id does not exist.
+        assertThrows(UnknownMemberIdException.class,
+            () -> group.validateOffsetCommit("unknown", "unknown", -1));
+
+        // The instance id does not exist.
+        assertThrows(UnknownMemberIdException.class,
+            () -> group.validateOffsetCommit("member-id", "unknown", -1));
+
+        // The generation id does is invalid.

Review Comment:
   nit: comment seems to have an extra word



-- 
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

Reply via email to