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

technoboy pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit fd5d96b03efad2b6b792bf4ce5b5d41a328adcbb
Author: Jiwei Guo <[email protected]>
AuthorDate: Wed Oct 12 14:56:59 2022 +0800

    Fix flaky test `testSplitBundleForMultiTimes`. (#17993)
---
 .../test/java/org/apache/pulsar/broker/admin/NamespacesTest.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java
index eaa54c1fd34..1a23b70f539 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java
@@ -1852,7 +1852,8 @@ public class NamespacesTest extends 
MockedPulsarServiceBaseTest {
     @Test
     public void testSplitBundleForMultiTimes() throws Exception{
         String namespace = BrokerTestUtil.newUniqueName(this.testTenant + 
"/namespace");
-        BundlesData data = BundlesData.builder().numBundles(4).build();
+        int initBundleCount = 4;
+        BundlesData data = 
BundlesData.builder().numBundles(initBundleCount).build();
         admin.namespaces().createNamespace(namespace, data);
         URL localWebServiceUrl = new URL(pulsar.getSafeWebServiceAddress());
         final NamespaceName testNs = NamespaceName.get(namespace);
@@ -1861,6 +1862,11 @@ public class NamespacesTest extends 
MockedPulsarServiceBaseTest {
             final BundlesData bundles = 
admin.namespaces().getBundles(namespace);
             final String bundle = bundles.getBoundaries().get(0) + "_" + 
bundles.getBoundaries().get(1);
             admin.namespaces().splitNamespaceBundle(namespace, bundle, true, 
null);
+            final int loop = i + 1;
+            Awaitility.await().pollInterval(1, 
TimeUnit.SECONDS).untilAsserted(() -> {
+                BundlesData currentBundles = 
admin.namespaces().getBundles(namespace);
+                assertEquals(currentBundles.getNumBundles(), initBundleCount + 
loop);
+            });
         }
         BundlesData bundles = admin.namespaces().getBundles(namespace);
         assertEquals(bundles.getNumBundles(), 14);

Reply via email to