diff --git a/test/unit/org/apache/cassandra/ServerTestUtils.java b/test/unit/org/apache/cassandra/ServerTestUtils.java index efa461e0aec3..cd286685c274 100644 --- a/test/unit/org/apache/cassandra/ServerTestUtils.java +++ b/test/unit/org/apache/cassandra/ServerTestUtils.java @@ -141,6 +141,7 @@ public static void cleanupAndLeaveDirs() throws IOException mkdirs(); // Creates the directories if they does not exists cleanup(); // Ensure that the directories are all empty CommitLog.instance.restartUnsafe(); + CommitLog.instance.segmentManager.awaitManagementTasksCompletion(); } /** diff --git a/test/unit/org/apache/cassandra/locator/AlibabaCloudSnitchTest.java b/test/unit/org/apache/cassandra/locator/AlibabaCloudSnitchTest.java index 04540cfdc517..809037e283d9 100644 --- a/test/unit/org/apache/cassandra/locator/AlibabaCloudSnitchTest.java +++ b/test/unit/org/apache/cassandra/locator/AlibabaCloudSnitchTest.java @@ -25,6 +25,7 @@ import org.junit.BeforeClass; import org.junit.Test; +import org.apache.cassandra.ServerTestUtils; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.db.Keyspace; import org.apache.cassandra.db.commitlog.CommitLog; @@ -47,10 +48,7 @@ public static void setup() throws Exception { System.setProperty(Gossiper.Props.DISABLE_THREAD_VALIDATION, "true"); DatabaseDescriptor.daemonInitialization(); - CommitLog.instance.start(); - CommitLog.instance.segmentManager.awaitManagementTasksCompletion(); - mkdirs(); - cleanup(); + ServerTestUtils.cleanupAndLeaveDirs(); Keyspace.setInitialized(); StorageService.instance.initServer(0); } diff --git a/test/unit/org/apache/cassandra/locator/CloudstackSnitchTest.java b/test/unit/org/apache/cassandra/locator/CloudstackSnitchTest.java index 51e83718825a..7f7a07e3f374 100644 --- a/test/unit/org/apache/cassandra/locator/CloudstackSnitchTest.java +++ b/test/unit/org/apache/cassandra/locator/CloudstackSnitchTest.java @@ -26,6 +26,7 @@ import org.junit.BeforeClass; import org.junit.Test; +import org.apache.cassandra.ServerTestUtils; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.db.Keyspace; import org.apache.cassandra.db.commitlog.CommitLog; @@ -48,10 +49,7 @@ public static void setup() throws Exception { System.setProperty(Gossiper.Props.DISABLE_THREAD_VALIDATION, "true"); DatabaseDescriptor.daemonInitialization(); - CommitLog.instance.start(); - CommitLog.instance.segmentManager.awaitManagementTasksCompletion(); - mkdirs(); - cleanup(); + ServerTestUtils.cleanupAndLeaveDirs(); Keyspace.setInitialized(); StorageService.instance.initServer(0); } diff --git a/test/unit/org/apache/cassandra/locator/Ec2SnitchTest.java b/test/unit/org/apache/cassandra/locator/Ec2SnitchTest.java index a7f503d1bdef..a555e0662015 100644 --- a/test/unit/org/apache/cassandra/locator/Ec2SnitchTest.java +++ b/test/unit/org/apache/cassandra/locator/Ec2SnitchTest.java @@ -29,6 +29,7 @@ import org.junit.BeforeClass; import org.junit.Test; +import org.apache.cassandra.ServerTestUtils; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.db.Keyspace; import org.apache.cassandra.db.commitlog.CommitLog; @@ -65,10 +66,7 @@ public static void setup() throws Exception { System.setProperty(Gossiper.Props.DISABLE_THREAD_VALIDATION, "true"); DatabaseDescriptor.daemonInitialization(); - CommitLog.instance.start(); - CommitLog.instance.segmentManager.awaitManagementTasksCompletion(); - mkdirs(); - cleanup(); + ServerTestUtils.cleanupAndLeaveDirs(); Keyspace.setInitialized(); StorageService.instance.initServer(0); } diff --git a/test/unit/org/apache/cassandra/locator/GoogleCloudSnitchTest.java b/test/unit/org/apache/cassandra/locator/GoogleCloudSnitchTest.java index 67192bdfa5de..5a8589022241 100644 --- a/test/unit/org/apache/cassandra/locator/GoogleCloudSnitchTest.java +++ b/test/unit/org/apache/cassandra/locator/GoogleCloudSnitchTest.java @@ -27,6 +27,7 @@ import org.junit.BeforeClass; import org.junit.Test; +import org.apache.cassandra.ServerTestUtils; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.db.Keyspace; import org.apache.cassandra.db.commitlog.CommitLog; @@ -49,10 +50,7 @@ public static void setup() throws Exception { System.setProperty(Gossiper.Props.DISABLE_THREAD_VALIDATION, "true"); DatabaseDescriptor.daemonInitialization(); - CommitLog.instance.start(); - CommitLog.instance.segmentManager.awaitManagementTasksCompletion(); - mkdirs(); - cleanup(); + ServerTestUtils.cleanupAndLeaveDirs(); Keyspace.setInitialized(); StorageService.instance.initServer(0); }