cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [01/16] cassandra git commit: Fix test interference in ColumnFamilyStoreTest
Date Mon, 16 Jan 2017 09:50:59 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 6504946a4 -> 806ac77ee
  refs/heads/cassandra-3.11 db2c50d81 -> 0b489776c
  refs/heads/cassandra-3.X 243be7812 -> 92cb311f9
  refs/heads/trunk d6c7a2db7 -> 7843d8cc2


Fix test interference in ColumnFamilyStoreTest

patch by Sylvain Lebresne; reviewed by Yuki Morishita for CASSANDRA-12890


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e5a55333
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e5a55333
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e5a55333

Branch: refs/heads/cassandra-3.11
Commit: e5a55333978dec926b40ae381ee489649d2cf365
Parents: b45cb10
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Dec 14 11:43:23 2016 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon Jan 16 10:32:31 2017 +0100

----------------------------------------------------------------------
 src/java/org/apache/cassandra/io/util/FileUtils.java      |  2 +-
 .../org/apache/cassandra/db/ColumnFamilyStoreTest.java    | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5a55333/src/java/org/apache/cassandra/io/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/FileUtils.java b/src/java/org/apache/cassandra/io/util/FileUtils.java
index 3124fcd..8d122dd 100644
--- a/src/java/org/apache/cassandra/io/util/FileUtils.java
+++ b/src/java/org/apache/cassandra/io/util/FileUtils.java
@@ -168,7 +168,7 @@ public final class FileUtils
 
     public static void renameWithConfirm(File from, File to)
     {
-        assert from.exists();
+        assert from.exists() : from + " should exist";
         if (logger.isTraceEnabled())
             logger.trace((String.format("Renaming %s to %s", from.getPath(), to.getPath())));
         // this is not FSWE because usually when we see it it's because we didn't close the
file before renaming it,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e5a55333/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 2d67baf..b21d3fa 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@ -120,6 +120,7 @@ public class ColumnFamilyStoreTest
     public static final String CF_STANDARD3 = "Standard3";
     public static final String CF_STANDARD4 = "Standard4";
     public static final String CF_STANDARD5 = "Standard5";
+    public static final String CF_STANDARD6 = "Standard6";
     public static final String CF_STANDARDINT = "StandardInteger1";
     public static final String CF_SUPER1 = "Super1";
     public static final String CF_SUPER6 = "Super6";
@@ -148,6 +149,7 @@ public class ColumnFamilyStoreTest
                                     SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD3),
                                     SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD4),
                                     SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD5),
+                                    SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD6),
                                     SchemaLoader.indexCFMD(KEYSPACE1, CF_INDEX1, true),
                                     SchemaLoader.indexCFMD(KEYSPACE1, CF_INDEX2, false),
                                     SchemaLoader.superCFMD(KEYSPACE1, CF_SUPER1, LongType.instance),
@@ -1137,7 +1139,7 @@ public class ColumnFamilyStoreTest
     public void testSliceByNamesCommandOldMetadata() throws Throwable
     {
         String keyspaceName = KEYSPACE1;
-        String cfName= CF_STANDARD1;
+        String cfName= CF_STANDARD6;
         DecoratedKey key = Util.dk("slice-name-old-metadata");
         CellName cname = cellname("c1");
         Keyspace keyspace = Keyspace.open(keyspaceName);
@@ -1154,7 +1156,11 @@ public class ColumnFamilyStoreTest
         cfs.clearUnsafe();
         assertEquals(0, cfs.getSSTables().size());
 
-        new File(ssTables.iterator().next().descriptor.filenameFor(Component.STATS)).delete();
+        SSTableReader sstable = ssTables.iterator().next();
+        File statsFile = new File(sstable.descriptor.filenameFor(Component.STATS));
+        assert statsFile.exists();
+        boolean deleted = statsFile.delete();
+        assert deleted : "Cannot delete " + statsFile;
         cfs.loadNewSSTables();
 
         // Add another cell with a lower timestamp


Mime
View raw message