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

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


The following commit(s) were added to refs/heads/master by this push:
     new cd6ce3e  Fix flaky AutoRecoveryMainTest (#2881)
cd6ce3e is described below

commit cd6ce3e8d513c62b5802094ca93d1b695c0d3611
Author: Enrico Olivelli <[email protected]>
AuthorDate: Mon Nov 8 12:54:14 2021 +0100

    Fix flaky AutoRecoveryMainTest (#2881)
---
 .../org/apache/bookkeeper/replication/AutoRecoveryMainTest.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AutoRecoveryMainTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AutoRecoveryMainTest.java
index 0c2221a..f013399 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AutoRecoveryMainTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AutoRecoveryMainTest.java
@@ -28,6 +28,7 @@ import org.apache.bookkeeper.bookie.BookieImpl;
 import org.apache.bookkeeper.meta.zk.ZKMetadataClientDriver;
 import org.apache.bookkeeper.net.BookieId;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
+import org.apache.bookkeeper.util.TestUtils;
 import org.apache.zookeeper.ZooKeeper;
 import org.junit.Test;
 
@@ -184,12 +185,13 @@ public class AutoRecoveryMainTest extends 
BookKeeperClusterTestCase {
      * start autoRecoveryMain and make sure all its components are running and
      * myVote node is existing
      */
-    ZKMetadataClientDriver startAutoRecoveryMain(AutoRecoveryMain 
autoRecoveryMain) {
+    ZKMetadataClientDriver startAutoRecoveryMain(AutoRecoveryMain 
autoRecoveryMain) throws Exception {
         autoRecoveryMain.start();
         ZKMetadataClientDriver metadataClientDriver = (ZKMetadataClientDriver) 
autoRecoveryMain.bkc
                 .getMetadataClientDriver();
-        assertTrue("autoRecoveryMain components should be running", 
autoRecoveryMain.auditorElector.isRunning()
-                && autoRecoveryMain.replicationWorker.isRunning() && 
autoRecoveryMain.isAutoRecoveryRunning());
+        TestUtils.assertEventuallyTrue("autoRecoveryMain components should be 
running",
+                () -> autoRecoveryMain.auditorElector.isRunning()
+                        && autoRecoveryMain.replicationWorker.isRunning() && 
autoRecoveryMain.isAutoRecoveryRunning());
         return metadataClientDriver;
     }
 }

Reply via email to