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

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 40e408d  Fix flaky test 
BrokerBkEnsemblesTests.testCrashBrokerWithoutCursorLedgerLeak (#14519)
40e408d is described below

commit 40e408de94cded5e0f76c395be8ca66c1abcd23b
Author: 包子 <[email protected]>
AuthorDate: Wed Mar 2 21:05:41 2022 +0800

    Fix flaky test 
BrokerBkEnsemblesTests.testCrashBrokerWithoutCursorLedgerLeak (#14519)
    
    - wrap assertion with Awaitility
---
 .../org/apache/pulsar/broker/service/BrokerBkEnsemblesTests.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerBkEnsemblesTests.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerBkEnsemblesTests.java
index aa63b22..8db3734 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerBkEnsemblesTests.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerBkEnsemblesTests.java
@@ -48,6 +48,7 @@ import org.apache.pulsar.client.api.Producer;
 import org.apache.pulsar.client.api.PulsarClient;
 import org.apache.pulsar.client.api.Schema;
 import org.apache.zookeeper.ZooKeeper;
+import org.awaitility.Awaitility;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -150,7 +151,9 @@ public class BrokerBkEnsemblesTests extends 
BkEnsemblesTestBase {
         Assert.assertNotEquals(cursorLedgerId, newCursorLedgerId);
 
         // cursor node must be deleted
-        Assert.assertNull(zk.exists(ledgerPath, false));
+        Awaitility.await().untilAsserted(() -> {
+            Assert.assertNull(zk.exists(ledgerPath, false));
+        });
 
         producer.close();
         consumer.close();

Reply via email to