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

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


The following commit(s) were added to refs/heads/branch-2.9 by this push:
     new 128f385c8cc cherry-pick -x "84968e8"
128f385c8cc is described below

commit 128f385c8cc5e65a4f4e1a132ce77a7f503b9c23
Author: fengyubiao <[email protected]>
AuthorDate: Fri Aug 19 07:43:47 2022 +0800

    cherry-pick -x "84968e8"
---
 .../org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
index 977415525d8..0a0de9593e8 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
@@ -32,6 +32,7 @@ import org.apache.pulsar.client.api.ProducerConsumerBase;
 import org.apache.pulsar.client.api.PulsarClientException;
 import org.apache.pulsar.client.api.Schema;
 import org.apache.pulsar.common.nar.NarClassLoader;
+import org.awaitility.Awaitility;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
@@ -111,7 +112,7 @@ public class BrokerInterceptorTest extends 
ProducerConsumerBase {
         BrokerInterceptor listener = pulsar.getBrokerInterceptor();
         Assert.assertTrue(listener instanceof CounterBrokerInterceptor);
         admin.namespaces().createNamespace("public/test", 4);
-        Assert.assertTrue(((CounterBrokerInterceptor)listener).getCount() >= 
1);
+        Awaitility.await().until(() -> ((CounterBrokerInterceptor) 
listener).getCount() >= 1);
     }
 
     @Test
@@ -120,7 +121,7 @@ public class BrokerInterceptorTest extends 
ProducerConsumerBase {
         Assert.assertTrue(listener instanceof CounterBrokerInterceptor);
         pulsarClient.newProducer(Schema.BOOL).topic("test").create();
         // CONNECT and PRODUCER
-        Assert.assertTrue(((CounterBrokerInterceptor)listener).getCount() >= 
2);
+        Awaitility.await().until(() -> ((CounterBrokerInterceptor) 
listener).getCount() >= 2);
     }
 
     @Test
@@ -173,6 +174,7 @@ public class BrokerInterceptorTest extends 
ProducerConsumerBase {
             }
         });
         future.get();
+        Awaitility.await().until(() -> 
!interceptor.getResponseList().isEmpty());
         CounterBrokerInterceptor.ResponseEvent responseEvent = 
interceptor.getResponseList().get(0);
         Assert.assertEquals(responseEvent.getRequestUri(), 
"/admin/v3/test/asyncGet/my-topic/1000");
         Assert.assertEquals(responseEvent.getResponseStatus(),

Reply via email to