You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jj...@apache.org on 2017/08/29 22:51:33 UTC

[3/6] cassandra git commit: SelectTest.testMixedTTLOnColumnsWide is flaky

SelectTest.testMixedTTLOnColumnsWide is flaky

Patch by Jeff Jirsa; Reviewed by Joel Knighton for CASSANDRA-13764


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

Branch: refs/heads/trunk
Commit: 67ac1496cc9e7d9d15be28b9536e9cdbce42473d
Parents: e817c83
Author: Jeff Jirsa <jj...@apple.com>
Authored: Tue Aug 29 12:43:38 2017 -0700
Committer: Jeff Jirsa <jj...@apple.com>
Committed: Tue Aug 29 15:50:23 2017 -0700

----------------------------------------------------------------------
 .../cql3/validation/operations/SelectTest.java  | 45 ++++++++++++++++----
 1 file changed, 37 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/67ac1496/test/unit/org/apache/cassandra/cql3/validation/operations/SelectTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectTest.java
index 3ee20a0..90b47b7 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectTest.java
@@ -2973,8 +2973,24 @@ public class SelectTest extends CQLTester
         execute("INSERT INTO %s (k) VALUES (2);");
         execute("INSERT INTO %s (k, i) VALUES (1, 1) USING TTL 100;");
         execute("INSERT INTO %s (k, i) VALUES (3, 3) USING TTL 100;");
-        assertRows(execute("SELECT k, i, TTL(i) FROM %s "),
-                   row(1, 1, 100), row(2, null, null), row(3, 3, 100));
+        assertRows(execute("SELECT k, i FROM %s "),
+                   row(1, 1),
+                   row(2, null),
+                   row(3, 3));
+
+        UntypedResultSet rs = execute("SELECT k, i, ttl(i) AS name_ttl FROM %s");
+        assertEquals("name_ttl", rs.metadata().get(2).name.toString());
+        int i = 0;
+        for (UntypedResultSet.Row row : rs)
+        {
+            if ( i % 2 == 0) // Every odd row has a null i/ttl
+                assertTrue(row.getInt("name_ttl") >= 90 && row.getInt("name_ttl") <= 100);
+            else
+                assertTrue(row.has("name_ttl") == false);
+
+            i++;
+        }
+
     }
 
     @Test
@@ -2986,11 +3002,24 @@ public class SelectTest extends CQLTester
         execute("INSERT INTO %s (k, c) VALUES (1, 2) ;");
         execute("INSERT INTO %s (k, c, i) VALUES (1, 3, 3) USING TTL 100;");
         execute("INSERT INTO %s (k, c, i) VALUES (3, 3, 3) USING TTL 100;");
-        assertRows(execute("SELECT k, c, i, TTL(i) FROM %s "),
-                   row(1, 1, 1, 100),
-                   row(1, 2, null, null),
-                   row(1, 3, 3, 100),
-                   row(2, 2, null, null),
-                   row(3, 3, 3, 100));
+        assertRows(execute("SELECT k, c, i FROM %s "),
+                   row(1, 1, 1),
+                   row(1, 2, null),
+                   row(1, 3, 3),
+                   row(2, 2, null),
+                   row(3, 3, 3));
+
+        UntypedResultSet rs = execute("SELECT k, c, i, ttl(i) AS name_ttl FROM %s");
+        assertEquals("name_ttl", rs.metadata().get(3).name.toString());
+        int i = 0;
+        for (UntypedResultSet.Row row : rs)
+        {
+            if ( i % 2 == 0) // Every odd row has a null i/ttl
+                assertTrue(row.getInt("name_ttl") >= 90 && row.getInt("name_ttl") <= 100);
+            else
+                assertTrue(row.has("name_ttl") == false);
+
+            i++;
+        }
     }
 }


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