CalvinKirs commented on code in PR #3392:
URL: https://github.com/apache/bookkeeper/pull/3392#discussion_r917395419


##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AutoRecoveryMainTest.java:
##########
@@ -49,11 +52,9 @@ public void testStartup() throws Exception {
         AutoRecoveryMain main = new AutoRecoveryMain(confByIndex(0));
         try {
             main.start();
-            Thread.sleep(500);
-            assertTrue("AuditorElector should be running",
-                    main.auditorElector.isRunning());
-            assertTrue("Replication worker should be running",
-                    main.replicationWorker.isRunning());
+            await().atMost(1, SECONDS).untilAsserted(() ->

Review Comment:
   The default await time is 10s



##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/AutoRecoveryMainTest.java:
##########
@@ -98,19 +96,7 @@ public void testAutoRecoverySessionLoss() throws Exception {
          */
         ZKMetadataClientDriver zkMetadataClientDriver1 = 
startAutoRecoveryMain(main1);
         ZooKeeper zk1 = zkMetadataClientDriver1.getZk();
-
-        // Wait until auditor gets elected
-        for (int i = 0; i < 10; i++) {
-            try {
-                if (main1.auditorElector.getCurrentAuditor() != null) {
-                    break;
-                } else {
-                    Thread.sleep(1000);
-                }
-            } catch (IOException e) {
-                Thread.sleep(1000);
-            }
-        }
+        await().atMost(20, SECONDS).until(() -> 
main1.auditorElector.getAuditor() != null);

Review Comment:
   Thanks,updated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to