This is an automated email from the ASF dual-hosted git repository. mmerli 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 c389b96f12 Speed up shutdown in test cases (#3809) c389b96f12 is described below commit c389b96f12cd8dbcb654acc84234afe3f981f698 Author: Hang Chen <chenh...@apache.org> AuthorDate: Tue Feb 28 03:02:17 2023 +0800 Speed up shutdown in test cases (#3809) * speed up shutdown in test cases * fix failed test --- .../java/org/apache/bookkeeper/replication/AutoRecoveryMainTest.java | 3 ++- .../java/org/apache/bookkeeper/test/BookKeeperClusterTestCase.java | 5 ++++- 2 files changed, 6 insertions(+), 2 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 ff390e3b27..a0e795034e 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 @@ -26,6 +26,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.util.concurrent.TimeUnit; import org.apache.bookkeeper.bookie.BookieImpl; import org.apache.bookkeeper.meta.zk.ZKMetadataClientDriver; import org.apache.bookkeeper.net.BookieId; @@ -118,7 +119,7 @@ public class AutoRecoveryMainTest extends BookKeeperClusterTestCase { assertNotNull(currentAuditor); Auditor auditor1 = main1.auditorElector.getAuditor(); assertEquals("Current Auditor should be AR1", currentAuditor, BookieImpl.getBookieId(confByIndex(0))); - Awaitility.await().untilAsserted(() -> { + Awaitility.waitAtMost(30, TimeUnit.SECONDS).untilAsserted(() -> { assertNotNull(auditor1); assertTrue("Auditor of AR1 should be running", auditor1.isRunning()); }); diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookKeeperClusterTestCase.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookKeeperClusterTestCase.java index 8f8596b5e2..76b21ecea2 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookKeeperClusterTestCase.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookKeeperClusterTestCase.java @@ -275,6 +275,7 @@ public abstract class BookKeeperClusterTestCase { bkc.close(); } + stopReplicationService(); for (ServerTester t : servers) { t.shutdown(); } @@ -316,6 +317,7 @@ public abstract class BookKeeperClusterTestCase { } protected void stopAllBookies(boolean shutdownClient) throws Exception { + stopReplicationService(); for (ServerTester t : servers) { t.shutdown(); } @@ -607,6 +609,7 @@ public abstract class BookKeeperClusterTestCase { throws Exception { // shut down bookie server List<ServerConfiguration> confs = new ArrayList<>(); + stopReplicationService(); for (ServerTester server : servers) { server.shutdown(); confs.add(server.getConfiguration()); @@ -964,7 +967,7 @@ public abstract class BookKeeperClusterTestCase { if (autoRecovery != null) { if (LOG.isDebugEnabled()) { - LOG.debug("Shutdown auto recovery for bookieserver: {}", address); + LOG.debug("Shutdown auto recovery for bookie server: {}", address); } autoRecovery.shutdown(); }