This is an automated email from the ASF dual-hosted git repository. bereng pushed a commit to branch cassandra-4.0 in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-4.0 by this push: new 7e4c77c Flaky DirectoriesTest.testSecondaryIndexDirectories 7e4c77c is described below commit 7e4c77c96887ac6f99b044b759495121024b582b Author: Bereng <berenguerbl...@gmail.com> AuthorDate: Wed May 5 10:53:54 2021 +0200 Flaky DirectoriesTest.testSecondaryIndexDirectories patch by Berenguer Blasi; reviewed by Benjamin Lerer for CASSANDRA-16627 --- .../org/apache/cassandra/db/DirectoriesTest.java | 34 ++++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/test/unit/org/apache/cassandra/db/DirectoriesTest.java b/test/unit/org/apache/cassandra/db/DirectoriesTest.java index 507827e..9756635 100644 --- a/test/unit/org/apache/cassandra/db/DirectoriesTest.java +++ b/test/unit/org/apache/cassandra/db/DirectoriesTest.java @@ -29,7 +29,9 @@ import java.util.concurrent.Future; import com.google.common.collect.Sets; import org.apache.commons.lang3.StringUtils; + import org.junit.AfterClass; +import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -65,18 +67,23 @@ public class DirectoriesTest { private static File tempDataDir; private static final String KS = "ks"; - private static final String[] TABLES = new String[] { "cf1", "ks" }; - - private static final Set<TableMetadata> CFM = new HashSet<>(TABLES.length); - - private static final Map<String, List<File>> files = new HashMap<>(); + private static String[] TABLES; + private static Set<TableMetadata> CFM; + private static Map<String, List<File>> files; @BeforeClass - public static void beforeClass() throws IOException + public static void beforeClass() { DatabaseDescriptor.daemonInitialization(); - FileUtils.setFSErrorHandler(new DefaultFSErrorHandler()); + } + + @Before + public void beforeTest() throws IOException + { + TABLES = new String[] { "cf1", "ks" }; + CFM = new HashSet<>(TABLES.length); + files = new HashMap<>(); for (String table : TABLES) { @@ -100,7 +107,7 @@ public class DirectoriesTest FileUtils.deleteRecursive(tempDataDir); } - private static DataDirectory[] toDataDirectories(File location) throws IOException + private static DataDirectory[] toDataDirectories(File location) { return new DataDirectory[] { new DataDirectory(location) }; } @@ -174,7 +181,7 @@ public class DirectoriesTest } @Test - public void testSecondaryIndexDirectories() throws IOException + public void testSecondaryIndexDirectories() { TableMetadata.Builder builder = TableMetadata.builder(KS, "cf") @@ -208,14 +215,9 @@ public class DirectoriesTest assertEquals(parentSnapshotDirectory, indexSnapshotDirectory.getParentFile()); // check if snapshot directory exists - parentSnapshotDirectory.mkdirs(); assertTrue(parentDirectories.snapshotExists("test")); assertTrue(indexDirectories.snapshotExists("test")); - // check their creation time - assertEquals(parentDirectories.snapshotCreationTime("test"), - indexDirectories.snapshotCreationTime("test")); - // check true snapshot size Descriptor parentSnapshot = new Descriptor(parentSnapshotDirectory, KS, PARENT_CFM.name, 0, SSTableFormat.Type.BIG); createFile(parentSnapshot.filenameFor(Component.DATA), 30); @@ -253,7 +255,7 @@ public class DirectoriesTest } @Test - public void testSSTableLister() throws IOException + public void testSSTableLister() { for (TableMetadata cfm : CFM) { @@ -622,7 +624,7 @@ public class DirectoriesTest } @Test - public void testIsStoredInLocalSystemKeyspacesDataLocation() throws IOException + public void testIsStoredInLocalSystemKeyspacesDataLocation() { for (String table : SystemKeyspace.TABLES_SPLIT_ACROSS_MULTIPLE_DISKS) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org