Add test to reproduce CASSANDRA-13382

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

Branch: refs/heads/master
Commit: aa0c412b69036a2980a2c5f228cd31cf589c684b
Parents: 7f29ad6
Author: Sylvain Lebresne <sylv...@datastax.com>
Authored: Mon Mar 27 14:55:26 2017 +0200
Committer: Sylvain Lebresne <sylv...@datastax.com>
Committed: Tue Mar 28 14:39:37 2017 +0200

----------------------------------------------------------------------
 upgrade_tests/cql_tests.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/aa0c412b/upgrade_tests/cql_tests.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/cql_tests.py b/upgrade_tests/cql_tests.py
index bd34269..d9245d2 100644
--- a/upgrade_tests/cql_tests.py
+++ b/upgrade_tests/cql_tests.py
@@ -5384,6 +5384,31 @@ class TestCQL(UpgradeTester):
 
             assert_one(cursor, "SELECT * FROM foo.bar", [0, 0])
 
+    @since('3.0')
+    def materialized_view_simple_test(self):
+        """
+        Test that creates and populate a simple materialized view.
+        @jira_ticket CASSANDRA-13382
+        """
+        cursor = self.prepare()
+
+        cursor.execute("CREATE KEYSPACE foo WITH replication = {'class': 
'SimpleStrategy', 'replication_factor': 1}")
+        cursor.execute("CREATE TABLE foo.test1 (k int, t int, v int, PRIMARY 
KEY(k, t))")
+
+        cursor.execute("""
+            CREATE MATERIALIZED VIEW foo.view1
+            AS SELECT * FROM foo.test1
+            WHERE v IS NOT NULL AND t IS NOT NULL
+            PRIMARY KEY (k, v, t)
+        """)
+
+        for i in range(0, 10):
+            cursor.execute("INSERT INTO foo.test1(k, t, v) VALUES (0, %d, %d)" 
% (i, 10 - i - 1))
+
+        for is_upgraded, cursor in self.do_upgrade(cursor):
+            debug("Querying {} node".format("upgraded" if is_upgraded else 
"old"))
+            assert_all(cursor, "SELECT v, t FROM foo.view1 WHERE k = 0", [[i, 
10 - i - 1] for i in range(0, 10)])
+
 
 topology_specs = [
     {'NODES': 3,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to