From 1c4fd0cd5cefbceb5a3279a29fdea0ae3bd1696a Mon Sep 17 00:00:00 2001 From: TestBoost Date: Mon, 11 Dec 2023 01:58:26 -0600 Subject: [PATCH] move zkRegCenter.init() and zkRegCenter.close() to @BeforeAll and @AfterAll to make tests run faster and look similar to other tests --- .../bootstrap/type/OneOffJobBootstrapTest.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/bootstrap/src/test/java/org/apache/shardingsphere/elasticjob/bootstrap/type/OneOffJobBootstrapTest.java b/bootstrap/src/test/java/org/apache/shardingsphere/elasticjob/bootstrap/type/OneOffJobBootstrapTest.java index 5528c28fca..9b5fe926eb 100644 --- a/bootstrap/src/test/java/org/apache/shardingsphere/elasticjob/bootstrap/type/OneOffJobBootstrapTest.java +++ b/bootstrap/src/test/java/org/apache/shardingsphere/elasticjob/bootstrap/type/OneOffJobBootstrapTest.java @@ -25,9 +25,8 @@ import org.apache.shardingsphere.elasticjob.test.util.EmbedTestingServer; import org.apache.shardingsphere.elasticjob.test.util.ReflectionUtils; import org.awaitility.Awaitility; -import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.quartz.Scheduler; import org.quartz.SchedulerException; @@ -48,21 +47,17 @@ class OneOffJobBootstrapTest { private static final int SHARDING_TOTAL_COUNT = 3; - private ZookeeperRegistryCenter zkRegCenter; + private static ZookeeperRegistryCenter zkRegCenter; @BeforeAll static void init() { EMBED_TESTING_SERVER.start(); - } - - @BeforeEach - void setUp() { - zkRegCenter = new ZookeeperRegistryCenter(ZOOKEEPER_CONFIGURATION); + zkRegCenter = new ZookeeperRegistryCenter(ZOOKEEPER_CONFIGURATION); zkRegCenter.init(); } - @AfterEach - void tearDown() { + @AfterAll + static void tearDown() { zkRegCenter.close(); }