This is an automated email from the ASF dual-hosted git repository.

RongtongJin pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new d442063fe0 [ISSUE #11007] Fix flaky CreateAndUpdateTopicIT by awaiting 
route propagation (#11008)
d442063fe0 is described below

commit d442063fe0fa071869582c590be3066d87a93beb
Author: lizhimins <[email protected]>
AuthorDate: Fri Sep 4 10:27:05 2026 +0800

    [ISSUE #11007] Fix flaky CreateAndUpdateTopicIT by awaiting route 
propagation (#11008)
    
    Wrap the topic route-size assertions in awaitility polling so the tests
    wait for broker->NameServer route propagation instead of asserting
    immediately. This removes the race condition that intermittently caused
    'Expected size: 3 but was: 2' failures in the CI pipeline.
    
    Applied to testCreateOrUpdateTopic_EnableSingleTopicRegistration,
    testStaticTopicNotAffected and 
testCreateOrUpdateTopic_EnableSplitRegistration,
    consistent with the existing awaitility pattern in the same class.
---
 .../test/route/CreateAndUpdateTopicIT.java         | 32 ++++++++++++++--------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git 
a/test/src/test/java/org/apache/rocketmq/test/route/CreateAndUpdateTopicIT.java 
b/test/src/test/java/org/apache/rocketmq/test/route/CreateAndUpdateTopicIT.java
index 9e9afb1ed2..9542352474 100644
--- 
a/test/src/test/java/org/apache/rocketmq/test/route/CreateAndUpdateTopicIT.java
+++ 
b/test/src/test/java/org/apache/rocketmq/test/route/CreateAndUpdateTopicIT.java
@@ -40,9 +40,11 @@ public class CreateAndUpdateTopicIT extends BaseConf {
         final boolean createResult = 
MQAdminTestUtils.createTopic(NAMESRV_ADDR, CLUSTER_NAME, topic, 8, null);
         assertThat(createResult).isTrue();
 
-        TopicRouteData route = 
MQAdminTestUtils.examineTopicRouteInfo(NAMESRV_ADDR, topic);
-        assertThat(route.getBrokerDatas()).hasSize(3);
-        assertThat(route.getQueueDatas()).hasSize(3);
+        await().atMost(30, TimeUnit.SECONDS).untilAsserted(() -> {
+            TopicRouteData route = 
MQAdminTestUtils.examineTopicRouteInfo(NAMESRV_ADDR, topic);
+            assertThat(route.getBrokerDatas()).hasSize(3);
+            assertThat(route.getQueueDatas()).hasSize(3);
+        });
 
         
brokerController1.getBrokerConfig().setEnableSingleTopicRegister(false);
         
brokerController2.getBrokerConfig().setEnableSingleTopicRegister(false);
@@ -103,14 +105,19 @@ public class CreateAndUpdateTopicIT extends BaseConf {
         boolean createResult = MQAdminTestUtils.createTopic(NAMESRV_ADDR, 
CLUSTER_NAME, testTopic, 8, null);
         assertThat(createResult).isTrue();
 
-        TopicRouteData route = 
MQAdminTestUtils.examineTopicRouteInfo(NAMESRV_ADDR, testTopic);
-        assertThat(route.getBrokerDatas()).hasSize(3);
-        assertThat(route.getQueueDatas()).hasSize(3);
+        await().atMost(30, TimeUnit.SECONDS).untilAsserted(() -> {
+            TopicRouteData route = 
MQAdminTestUtils.examineTopicRouteInfo(NAMESRV_ADDR, testTopic);
+            assertThat(route.getBrokerDatas()).hasSize(3);
+            assertThat(route.getQueueDatas()).hasSize(3);
+        });
 
         MQAdminTestUtils.createStaticTopicWithCommand(testStaticTopic, 10, 
null, CLUSTER_NAME, NAMESRV_ADDR);
 
-        assertThat(route.getBrokerDatas()).hasSize(3);
-        assertThat(route.getQueueDatas()).hasSize(3);
+        await().atMost(30, TimeUnit.SECONDS).untilAsserted(() -> {
+            TopicRouteData route = 
MQAdminTestUtils.examineTopicRouteInfo(NAMESRV_ADDR, testTopic);
+            assertThat(route.getBrokerDatas()).hasSize(3);
+            assertThat(route.getQueueDatas()).hasSize(3);
+        });
 
         
brokerController1.getBrokerConfig().setEnableSingleTopicRegister(false);
         
brokerController2.getBrokerConfig().setEnableSingleTopicRegister(false);
@@ -138,9 +145,12 @@ public class CreateAndUpdateTopicIT extends BaseConf {
         brokerController3.registerBrokerAll(false, true, true);
 
         for (int i = 0; i < 10; i++) {
-            TopicRouteData route = 
MQAdminTestUtils.examineTopicRouteInfo(NAMESRV_ADDR, testTopic + i);
-            assertThat(route.getBrokerDatas()).hasSize(3);
-            assertThat(route.getQueueDatas()).hasSize(3);
+            final String topicName = testTopic + i;
+            await().atMost(30, TimeUnit.SECONDS).untilAsserted(() -> {
+                TopicRouteData route = 
MQAdminTestUtils.examineTopicRouteInfo(NAMESRV_ADDR, topicName);
+                assertThat(route.getBrokerDatas()).hasSize(3);
+                assertThat(route.getQueueDatas()).hasSize(3);
+            });
         }
 
         brokerController1.getBrokerConfig().setEnableSplitRegistration(false);

Reply via email to