Skip to content

Commit a2c1c5b

Browse files
committed
fix tests
1 parent 84ec174 commit a2c1c5b

File tree

1 file changed

+50
-3
lines changed

1 file changed

+50
-3
lines changed

group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9645,19 +9645,43 @@ public void testStreamsGroupDescribeNoErrors() {
96459645
.setProcessId("processId")
96469646
.setMemberEpoch(epoch)
96479647
.setPreviousMemberEpoch(epoch - 1);
9648+
String subtopology1 = "subtopology1";
9649+
String fooTopicName = "foo";
9650+
StreamsTopology topology = new StreamsTopology(
9651+
0,
9652+
Map.of(subtopology1,
9653+
new StreamsGroupTopologyValue.Subtopology()
9654+
.setSubtopologyId(subtopology1)
9655+
.setSourceTopics(List.of(fooTopicName))
9656+
)
9657+
);
96489658

96499659
GroupMetadataManagerTestContext context = new GroupMetadataManagerTestContext.Builder()
9650-
.withStreamsGroup(new StreamsGroupBuilder(streamsGroupIds.get(0), epoch))
9660+
.withStreamsGroup(new StreamsGroupBuilder(streamsGroupIds.get(0), epoch)
9661+
.withTopology(topology)
9662+
)
96519663
.withStreamsGroup(new StreamsGroupBuilder(streamsGroupIds.get(1), epoch)
9652-
.withMember(memberBuilder.build()))
9664+
.withMember(memberBuilder.build())
9665+
.withTopology(topology)
9666+
)
96539667
.build();
96549668

9669+
StreamsGroupDescribeResponseData.Topology expectedTopology =
9670+
new StreamsGroupDescribeResponseData.Topology()
9671+
.setEpoch(0)
9672+
.setSubtopologies(List.of(
9673+
new StreamsGroupDescribeResponseData.Subtopology()
9674+
.setSubtopologyId(subtopology1)
9675+
.setSourceTopics(List.of(fooTopicName))
9676+
));
9677+
96559678
List<StreamsGroupDescribeResponseData.DescribedGroup> expected = Arrays.asList(
96569679
new StreamsGroupDescribeResponseData.DescribedGroup()
96579680
.setGroupEpoch(epoch)
96589681
.setGroupId(streamsGroupIds.get(0))
96599682
.setGroupState(StreamsGroupState.EMPTY.toString())
9660-
.setAssignmentEpoch(0),
9683+
.setAssignmentEpoch(0)
9684+
.setTopology(expectedTopology),
96619685
new StreamsGroupDescribeResponseData.DescribedGroup()
96629686
.setGroupEpoch(epoch)
96639687
.setGroupId(streamsGroupIds.get(1))
@@ -9666,6 +9690,7 @@ public void testStreamsGroupDescribeNoErrors() {
96669690
TasksTuple.EMPTY
96679691
)
96689692
))
9693+
.setTopology(expectedTopology)
96699694
.setGroupState(StreamsGroupState.NOT_READY.toString())
96709695
);
96719696
List<StreamsGroupDescribeResponseData.DescribedGroup> actual = context.sendStreamsGroupDescribe(streamsGroupIds);
@@ -9695,13 +9720,24 @@ public void testStreamsGroupDescribeBeforeAndAfterCommittingOffset() {
96959720
String memberId1 = "memberId1";
96969721
String memberId2 = "memberId2";
96979722
String subtopologyId = "subtopology1";
9723+
String fooTopicName = "foo";
9724+
StreamsGroupTopologyValue topology = new StreamsGroupTopologyValue()
9725+
.setEpoch(0)
9726+
.setSubtopologies(
9727+
List.of(
9728+
new StreamsGroupTopologyValue.Subtopology()
9729+
.setSubtopologyId(subtopologyId)
9730+
.setSourceTopics(List.of(fooTopicName))
9731+
)
9732+
);
96989733

96999734
GroupMetadataManagerTestContext context = new GroupMetadataManagerTestContext.Builder().build();
97009735

97019736
StreamsGroupMember.Builder memberBuilder1 = streamsGroupMemberBuilderWithDefaults(memberId1);
97029737
context.replay(StreamsCoordinatorRecordHelpers.newStreamsGroupMemberRecord(streamsGroupId, memberBuilder1.build()));
97039738
context.replay(StreamsCoordinatorRecordHelpers.newStreamsGroupCurrentAssignmentRecord(streamsGroupId, memberBuilder1.build()));
97049739
context.replay(StreamsCoordinatorRecordHelpers.newStreamsGroupEpochRecord(streamsGroupId, epoch + 1, 0));
9740+
context.replay(StreamsCoordinatorRecordHelpers.newStreamsGroupTopologyRecord(streamsGroupId, topology));
97059741

97069742
TasksTuple assignment = new TasksTuple(
97079743
Map.of(subtopologyId, Set.of(0, 1)),
@@ -9733,6 +9769,17 @@ public void testStreamsGroupDescribeBeforeAndAfterCommittingOffset() {
97339769
memberBuilder1.build().asStreamsGroupDescribeMember(TasksTuple.EMPTY),
97349770
memberBuilder2.build().asStreamsGroupDescribeMember(assignment)
97359771
))
9772+
.setTopology(
9773+
new StreamsGroupDescribeResponseData.Topology()
9774+
.setEpoch(0)
9775+
.setSubtopologies(
9776+
List.of(
9777+
new StreamsGroupDescribeResponseData.Subtopology()
9778+
.setSubtopologyId(subtopologyId)
9779+
.setSourceTopics(List.of(fooTopicName))
9780+
)
9781+
)
9782+
)
97369783
.setGroupState(StreamsGroup.StreamsGroupState.NOT_READY.toString())
97379784
.setGroupEpoch(epoch + 2);
97389785
assertEquals(1, actual.size());

0 commit comments

Comments
 (0)