vamossagar12 commented on code in PR #14432: URL: https://github.com/apache/kafka/pull/14432#discussion_r1405739030
########## group-coordinator/src/test/java/org/apache/kafka/coordinator/group/consumer/TargetAssignmentBuilderTest.java: ########## @@ -691,6 +735,91 @@ public void testDeleteMember() { assertEquals(expectedAssignment, result.targetAssignment()); } + @Test + public void testStaticMemberReplace() { + TargetAssignmentBuilderTestContext context = new TargetAssignmentBuilderTestContext( + "my-group", + 20 + ); + + Uuid fooTopicId = context.addTopicMetadata("foo", 6, Collections.emptyMap()); + Uuid barTopicId = context.addTopicMetadata("bar", 6, Collections.emptyMap()); + + context.addGroupMember("member-1", "member-1", Arrays.asList("foo", "bar", "zar"), mkAssignment( + mkTopicAssignment(fooTopicId, 1, 2), + mkTopicAssignment(barTopicId, 1, 2) + )); + + context.addGroupMember("member-2", "member-2", Arrays.asList("foo", "bar", "zar"), mkAssignment( + mkTopicAssignment(fooTopicId, 3, 4), + mkTopicAssignment(barTopicId, 3, 4) + )); + + context.addGroupMember("member-3", "member-3", Arrays.asList("foo", "bar", "zar"), mkAssignment( + mkTopicAssignment(fooTopicId, 5, 6), + mkTopicAssignment(barTopicId, 5, 6) + )); + + context.updateMemberSubscription("member-1", Arrays.asList("foo", "bar", "zar"), Optional.of("member-1"), Optional.empty()); + context.updateMemberSubscription("member-2", Arrays.asList("foo", "bar", "zar"), Optional.of("member-2"), Optional.empty()); + context.updateMemberSubscription("member-3", Arrays.asList("foo", "bar", "zar"), Optional.of("member-3"), Optional.empty()); + + // Static member 3 leaves + context.removeMemberSubscription("member-3", "member-3"); + + // Another static member joins with the same instance id as the departed one + context.addGroupMember("member-3-a", "member-3", Arrays.asList("foo", "bar", "zar"), new HashMap<>()); Review Comment: Ok.. I am slightly confused by this comment. The new member is being added using `addGroupMember` which internally invokes `withMembers`. I had an unwanted call to `updateMemberSubscription` which I have removed. Probably I am missing something here. -- 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