From ae5d500b293795e9f3b7680cfb07d05366409860 Mon Sep 17 00:00:00 2001 From: Yunze Xu Date: Sun, 2 Jul 2023 08:39:29 +0800 Subject: [PATCH] [branch-2.11] Fix failed GroupMetadataManagerTest (#1934) ### Motivation When running `GroupMetadataManagerTest`, `testOffsetWriteAfterGroupRemoved` will be called after `testOffsetTopicNumPartitionsModify`, which changes the `offsetTopicNumPartitions` to 100 so that `consumerGroupPartitionId` will be 74 while `groupPartitionId` is 0, and then the group metadata will be sent to partition 0 while `scheduleLoadGroupAndOffsets` will read from partition 74. Since no group metadata is loaded, ### Modifications Migrate the fix in https://github.com/streamnative/kop/pull/1759 to reset the `offsetTopicNumPartitions` before and after each method. --- .../kop/coordinator/group/GroupMetadataManagerTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/group/GroupMetadataManagerTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/group/GroupMetadataManagerTest.java index 8dbea74356..b7e184ae9d 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/group/GroupMetadataManagerTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/group/GroupMetadataManagerTest.java @@ -130,6 +130,7 @@ public void cleanup() throws Exception { @BeforeMethod protected void setUp() throws PulsarClientException, PulsarAdminException { + conf.setOffsetsTopicNumPartitions(numOffsetsPartitions); producerBuilder = pulsarClient.newProducer(Schema.BYTEBUFFER); readerBuilder = pulsarClient.newReader(Schema.BYTEBUFFER) .startMessageId(MessageId.earliest); @@ -167,6 +168,7 @@ protected void setUp() throws PulsarClientException, PulsarAdminException { @AfterMethod protected void tearDown() throws PulsarClientException { + conf.setOffsetsTopicNumPartitions(numOffsetsPartitions); if (consumer != null) { consumer.close(); }