m1a2st commented on code in PR #20184:
URL: https://github.com/apache/kafka/pull/20184#discussion_r2222807285


##########
core/src/test/scala/unit/kafka/server/GroupCoordinatorBaseRequestTest.scala:
##########
@@ -123,16 +123,35 @@ class GroupCoordinatorBaseRequestTest(cluster: 
ClusterInstance) {
     topicConfig: Properties = new Properties
   ): Map[TopicIdPartition, Int] = {
     val admin = cluster.admin()
+    var partitionToLeader: scala.collection.immutable.Map[Int, Int] = null
     try {
-      val partitionToLeader = TestUtils.createTopicWithAdmin(
-        admin = admin,
-        topic = topic,
-        brokers = brokers(),
-        controllers = controllerServers(),
-        numPartitions = numPartitions,
-        replicationFactor = replicationFactor,
-        topicConfig = topicConfig
+      TestUtils.waitUntilTrue(
+        condition = () => {
+          try {
+            partitionToLeader = TestUtils.createTopicWithAdmin(
+              admin = admin,
+              topic = topic,
+              brokers = brokers(),
+              controllers = controllerServers(),
+              numPartitions = numPartitions,
+              replicationFactor = replicationFactor,
+              topicConfig = topicConfig
+            )
+            true // Success
+          } catch {
+            case _: Throwable => false // Will retry
+          }
+        },
+        msg = "Failed to create topic with admin within 2 minutes",
+        waitTimeMs = 2 * 60 * 1000, // 2 minutes in milliseconds
+        pause = 40 * 1000 // 40 seconds in milliseconds

Review Comment:
   Just out of curiosity, why does the CreateTopic operation sometimes take up 
to 2 minutes to succeed? Is there a configuration that controls this behavior?



-- 
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

Reply via email to