cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cassandra git commit: Make test index names unique
Date Thu, 31 Mar 2016 08:02:24 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 6807c5984 -> f8cc86039


Make test index names unique

Patch by Sam Tunnicliffe; reviewed by Sylvain Lebresne for
CASSANDRA-11453


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

Branch: refs/heads/cassandra-3.0
Commit: f8cc86039a09f2632016c830d63a7b95195cbced
Parents: 6807c59
Author: Sam Tunnicliffe <sam@beobal.com>
Authored: Tue Mar 29 16:23:03 2016 +0100
Committer: Sam Tunnicliffe <sam@beobal.com>
Committed: Thu Mar 31 09:00:42 2016 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/cql3/CQLTester.java    |  1 +
 .../apache/cassandra/index/CustomIndexTest.java | 30 ++++++++++++--------
 2 files changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8cc8603/test/unit/org/apache/cassandra/cql3/CQLTester.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/CQLTester.java b/test/unit/org/apache/cassandra/cql3/CQLTester.java
index 43de101..a7145fc 100644
--- a/test/unit/org/apache/cassandra/cql3/CQLTester.java
+++ b/test/unit/org/apache/cassandra/cql3/CQLTester.java
@@ -626,6 +626,7 @@ public abstract class CQLTester
         }
         catch (Exception e)
         {
+            logger.info("Error performing schema change", e);
             throw new RuntimeException("Error setting schema for test (query was: " + query
+ ")", e);
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8cc8603/test/unit/org/apache/cassandra/index/CustomIndexTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/index/CustomIndexTest.java b/test/unit/org/apache/cassandra/index/CustomIndexTest.java
index b1fd992..0b553f4 100644
--- a/test/unit/org/apache/cassandra/index/CustomIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/CustomIndexTest.java
@@ -392,30 +392,34 @@ public class CustomIndexTest extends CQLTester
     public void customExpressionsDisallowedInModifications() throws Throwable
     {
         createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY KEY (a, b))");
-        createIndex(String.format("CREATE CUSTOM INDEX custom_index ON %%s(c) USING '%s'",
StubIndex.class.getName()));
+        String indexName = currentTable() + "_custom_index";
+        createIndex(String.format("CREATE CUSTOM INDEX %s ON %%s(c) USING '%s'",
+                                  indexName, StubIndex.class.getName()));
 
         assertInvalidThrowMessage(Server.CURRENT_VERSION,
                                   ModificationStatement.CUSTOM_EXPRESSIONS_NOT_ALLOWED,
                                   QueryValidationException.class,
-                                  "DELETE FROM %s WHERE expr(custom_index, 'foo bar baz ')");
+                                  String.format("DELETE FROM %%s WHERE expr(%s, 'foo bar
baz ')", indexName));
         assertInvalidThrowMessage(Server.CURRENT_VERSION,
                                   ModificationStatement.CUSTOM_EXPRESSIONS_NOT_ALLOWED,
                                   QueryValidationException.class,
-                                  "UPDATE %s SET d=0 WHERE expr(custom_index, 'foo bar baz
')");
+                                  String.format("UPDATE %%s SET d=0 WHERE expr(%s, 'foo bar
baz ')", indexName));
     }
 
     @Test
     public void indexSelectionPrefersMostSelectiveIndex() throws Throwable
     {
         createTable("CREATE TABLE %s(a int, b int, c int, PRIMARY KEY (a))");
-        createIndex(String.format("CREATE CUSTOM INDEX more_selective ON %%s(b) USING '%s'",
+        createIndex(String.format("CREATE CUSTOM INDEX %s_more_selective ON %%s(b) USING
'%s'",
+                                  currentTable(),
                                   SettableSelectivityIndex.class.getName()));
-        createIndex(String.format("CREATE CUSTOM INDEX less_selective ON %%s(c) USING '%s'",
+        createIndex(String.format("CREATE CUSTOM INDEX %s_less_selective ON %%s(c) USING
'%s'",
+                                  currentTable(),
                                   SettableSelectivityIndex.class.getName()));
         SettableSelectivityIndex moreSelective =
-            (SettableSelectivityIndex)getCurrentColumnFamilyStore().indexManager.getIndexByName("more_selective");
+            (SettableSelectivityIndex)getCurrentColumnFamilyStore().indexManager.getIndexByName(currentTable()
+ "_more_selective");
         SettableSelectivityIndex lessSelective =
-            (SettableSelectivityIndex)getCurrentColumnFamilyStore().indexManager.getIndexByName("less_selective");
+            (SettableSelectivityIndex)getCurrentColumnFamilyStore().indexManager.getIndexByName(currentTable()
+ "_less_selective");
         assertEquals(0, moreSelective.searchersProvided);
         assertEquals(0, lessSelective.searchersProvided);
 
@@ -437,14 +441,16 @@ public class CustomIndexTest extends CQLTester
     public void customExpressionForcesIndexSelection() throws Throwable
     {
         createTable("CREATE TABLE %s(a int, b int, c int, PRIMARY KEY (a))");
-        createIndex(String.format("CREATE CUSTOM INDEX more_selective ON %%s(b) USING '%s'",
+        createIndex(String.format("CREATE CUSTOM INDEX %s_more_selective ON %%s(b) USING
'%s'",
+                                  currentTable(),
                                   SettableSelectivityIndex.class.getName()));
-        createIndex(String.format("CREATE CUSTOM INDEX less_selective ON %%s(c) USING '%s'",
+        createIndex(String.format("CREATE CUSTOM INDEX %s_less_selective ON %%s(c) USING
'%s'",
+                                  currentTable(),
                                   SettableSelectivityIndex.class.getName()));
         SettableSelectivityIndex moreSelective =
-            (SettableSelectivityIndex)getCurrentColumnFamilyStore().indexManager.getIndexByName("more_selective");
+            (SettableSelectivityIndex)getCurrentColumnFamilyStore().indexManager.getIndexByName(currentTable()
+ "_more_selective");
         SettableSelectivityIndex lessSelective =
-            (SettableSelectivityIndex)getCurrentColumnFamilyStore().indexManager.getIndexByName("less_selective");
+            (SettableSelectivityIndex)getCurrentColumnFamilyStore().indexManager.getIndexByName(currentTable()
+ "_less_selective");
         assertEquals(0, moreSelective.searchersProvided);
         assertEquals(0, lessSelective.searchersProvided);
 
@@ -456,7 +462,7 @@ public class CustomIndexTest extends CQLTester
         assertEquals(0, lessSelective.searchersProvided);
 
         // when a custom expression is present, its target index should be preferred
-        execute("SELECT * FROM %s WHERE b=0 AND expr(less_selective, 'expression') ALLOW
FILTERING");
+        execute(String.format("SELECT * FROM %%s WHERE b=0 AND expr(%s_less_selective, 'expression')
ALLOW FILTERING", currentTable()));
         assertEquals(1, moreSelective.searchersProvided);
         assertEquals(1, lessSelective.searchersProvided);
     }


Mime
View raw message