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 55376af  Fix flaky test 
GracefulExecutorServicesShutdownTest.shouldTerminateWhenFutureIsCancelled 
(#10592)
55376af is described below

commit 55376af6cc2481c368b734c9286d05a839320db1
Author: linlinnn <linjunhuac...@163.com>
AuthorDate: Sat May 15 02:17:17 2021 +0800

    Fix flaky test 
GracefulExecutorServicesShutdownTest.shouldTerminateWhenFutureIsCancelled 
(#10592)
    
    * fix flaky test 
GracefulExecutorServicesShutdownTest.shouldTerminateWhenFutureIsCancelled
    
    * avoid import *
---
 .../pulsar/broker/service/GracefulExecutorServicesShutdownTest.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/GracefulExecutorServicesShutdownTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/GracefulExecutorServicesShutdownTest.java
index b978507..726f37d 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/GracefulExecutorServicesShutdownTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/GracefulExecutorServicesShutdownTest.java
@@ -35,6 +35,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
 import org.testng.annotations.Test;
+import org.awaitility.Awaitility;
 
 public class GracefulExecutorServicesShutdownTest {
 
@@ -151,8 +152,8 @@ public class GracefulExecutorServicesShutdownTest {
         future.cancel(false);
 
         // then
-        assertTrue(awaitTerminationInterrupted.get(),
-                "awaitTermination should have been interrupted");
+        Awaitility.await().untilAsserted(() -> 
assertTrue(awaitTerminationInterrupted.get(),
+                "awaitTermination should have been interrupted"));
         verify(executorService, times(1)).awaitTermination(anyLong(), any());
         verify(executorService, times(1)).shutdownNow();
     }

Reply via email to