mirror of https://github.com/apache/kafka.git
KAFKA-19210: resolved the flakiness in testShareGroupHeartbeatInitializeOnPartitionUpdate (#19601)
The test testShareGroupHeartbeatInitializeOnPartitionUpdate was flaky earlier. The shareGroupStatePartitionMetadataRecord that is created during heartbeat contains 2 topics to be initialized, but the order in which they appear in the list is not deterministic. The test is changed to simply see whether the contents of the record is correct instead of directly comparing it with an expected record which may contains the correct topics, but in some different order. Reviewers: Sushant Mahajan <smahajan@confluent.io>, Andrew Schofield <aschofield@confluent.io>
This commit is contained in:
parent
19609d5986
commit
b8de78cafd
|
@ -21260,16 +21260,21 @@ public class GroupMetadataManagerTest {
|
|||
.setMemberEpoch(0)
|
||||
.setSubscribedTopicNames(List.of(t1Name, t2Name)));
|
||||
|
||||
assertTrue(result.records().contains(
|
||||
newShareGroupStatePartitionMetadataRecord(groupId, mkShareGroupStateMap(List.of(
|
||||
mkShareGroupStateMetadataEntry(t1Uuid, t1Name, List.of(0, 1)),
|
||||
mkShareGroupStateMetadataEntry(t2Uuid, t2Name, List.of(0, 1))
|
||||
)),
|
||||
Map.of(),
|
||||
Map.of()
|
||||
))
|
||||
CoordinatorRecord expected = newShareGroupStatePartitionMetadataRecord(
|
||||
groupId,
|
||||
mkShareGroupStateMap(List.of(
|
||||
mkShareGroupStateMetadataEntry(t1Uuid, t1Name, List.of(0, 1)),
|
||||
mkShareGroupStateMetadataEntry(t2Uuid, t2Name, List.of(0, 1))
|
||||
)),
|
||||
Map.of(),
|
||||
Map.of()
|
||||
);
|
||||
|
||||
Optional<CoordinatorRecord> actual = result.records().stream().filter(record -> record.key() instanceof ShareGroupStatePartitionMetadataKey)
|
||||
.findAny();
|
||||
assertTrue(actual.isPresent());
|
||||
assertRecordEquals(expected, actual.get());
|
||||
|
||||
verifyShareGroupHeartbeatInitializeRequest(
|
||||
result.response().getValue(),
|
||||
Map.of(
|
||||
|
@ -21330,18 +21335,23 @@ public class GroupMetadataManagerTest {
|
|||
.setMemberEpoch(1)
|
||||
.setSubscribedTopicNames(null));
|
||||
|
||||
assertTrue(result.records().contains(
|
||||
newShareGroupStatePartitionMetadataRecord(groupId, mkShareGroupStateMap(List.of(
|
||||
mkShareGroupStateMetadataEntry(t1Uuid, t1Name, List.of(2, 3))
|
||||
)),
|
||||
mkShareGroupStateMap(List.of(
|
||||
mkShareGroupStateMetadataEntry(t1Uuid, t1Name, List.of(0, 1)),
|
||||
mkShareGroupStateMetadataEntry(t2Uuid, t2Name, List.of(0, 1))
|
||||
)),
|
||||
Map.of()
|
||||
))
|
||||
expected = newShareGroupStatePartitionMetadataRecord(
|
||||
groupId,
|
||||
mkShareGroupStateMap(List.of(
|
||||
mkShareGroupStateMetadataEntry(t1Uuid, t1Name, List.of(2, 3))
|
||||
)),
|
||||
mkShareGroupStateMap(List.of(
|
||||
mkShareGroupStateMetadataEntry(t1Uuid, t1Name, List.of(0, 1)),
|
||||
mkShareGroupStateMetadataEntry(t2Uuid, t2Name, List.of(0, 1))
|
||||
)),
|
||||
Map.of()
|
||||
);
|
||||
|
||||
actual = result.records().stream().filter(record -> record.key() instanceof ShareGroupStatePartitionMetadataKey)
|
||||
.findAny();
|
||||
assertTrue(actual.isPresent());
|
||||
assertRecordEquals(expected, actual.get());
|
||||
|
||||
verifyShareGroupHeartbeatInitializeRequest(
|
||||
result.response().getValue(),
|
||||
Map.of(
|
||||
|
|
Loading…
Reference in New Issue