From 4fcb8b247ec28b9f6e64f8f663e34f5becf0f25f Mon Sep 17 00:00:00 2001 From: kevin-wu24 <66326898+kevin-wu24@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:22:11 -0600 Subject: [PATCH] KAFKA-17988: Fix flaky ReconfigurableQuorumIntegrationTest.testRemoveAndAddSameController (#17782) Reviewers: David Arthur --- .../server/ReconfigurableQuorumIntegrationTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/kafka/server/ReconfigurableQuorumIntegrationTest.java b/core/src/test/java/kafka/server/ReconfigurableQuorumIntegrationTest.java index 9dd29dd363d0d..539c11b7c7eb7 100644 --- a/core/src/test/java/kafka/server/ReconfigurableQuorumIntegrationTest.java +++ b/core/src/test/java/kafka/server/ReconfigurableQuorumIntegrationTest.java @@ -24,7 +24,6 @@ import org.apache.kafka.common.Uuid; import org.apache.kafka.common.test.KafkaClusterTestKit; import org.apache.kafka.common.test.TestKitNodes; -import org.apache.kafka.common.test.api.Flaky; import org.apache.kafka.server.common.KRaftVersion; import org.apache.kafka.test.TestUtils; @@ -130,7 +129,6 @@ public void testRemoveController() throws Exception { } } - @Flaky("KAFKA-17988") @Test public void testRemoveAndAddSameController() throws Exception { try (KafkaClusterTestKit cluster = new KafkaClusterTestKit.Builder( @@ -152,6 +150,13 @@ public void testRemoveAndAddSameController() throws Exception { }); Uuid dirId = cluster.nodes().controllerNodes().get(3000).metadataDirectoryId(); admin.removeRaftVoter(3000, dirId).all().get(); + TestUtils.retryOnExceptionWithTimeout(30_000, 10, () -> { + Map voters = findVoterDirs(admin); + assertEquals(new HashSet<>(Arrays.asList(3001, 3002, 3003)), voters.keySet()); + for (int replicaId : new int[] {3001, 3002, 3003}) { + assertNotEquals(Uuid.ZERO_UUID, voters.get(replicaId)); + } + }); admin.addRaftVoter( 3000, dirId,