You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2015/08/09 21:17:10 UTC

cassandra git commit: Makes AggregationTest.testAggregateWithWriteTimeOrTTL more robust

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 087153394 -> a5297f16e


Makes AggregationTest.testAggregateWithWriteTimeOrTTL more robust

patch by Benjamin Lerer; reviewed by Aleksey Yeschenko for CASSANDRA-9891


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

Branch: refs/heads/cassandra-2.2
Commit: a5297f16eede718eac021f27d6825d1062661be6
Parents: 0871533
Author: blerer <be...@datastax.com>
Authored: Sun Aug 9 21:12:11 2015 +0200
Committer: blerer <be...@datastax.com>
Committed: Sun Aug 9 21:12:11 2015 +0200

----------------------------------------------------------------------
 .../cql3/validation/operations/AggregationTest.java      | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5297f16/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
index 51e4a28..120fc21 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
@@ -167,7 +167,7 @@ public class AggregationTest extends CQLTester
     }
 
     @Test
-    public void testAggregateWithWithWriteTimeOrTTL() throws Throwable
+    public void testAggregateWithWriteTimeOrTTL() throws Throwable
     {
         createTable("CREATE TABLE %s (a int primary key, b int, c int)");
 
@@ -180,8 +180,9 @@ public class AggregationTest extends CQLTester
         long today = System.currentTimeMillis() * 1000;
         long yesterday = today - (DateUtils.MILLIS_PER_DAY * 1000);
 
-        execute("INSERT INTO %s (a, b, c) VALUES (1, 2, null) USING TTL 5;");
-        execute("INSERT INTO %s (a, b, c) VALUES (2, 4, 6) USING TTL 2;");
+        final int secondsPerMinute = 60;
+        execute("INSERT INTO %s (a, b, c) VALUES (1, 2, null) USING TTL " + (20 * secondsPerMinute));
+        execute("INSERT INTO %s (a, b, c) VALUES (2, 4, 6) USING TTL " + (10 * secondsPerMinute));
         execute("INSERT INTO %s (a, b, c) VALUES (4, 8, 12) USING TIMESTAMP " + yesterday );
 
         assertRows(execute("SELECT count(writetime(b)), count(ttl(b)) FROM %s"),
@@ -190,8 +191,8 @@ public class AggregationTest extends CQLTester
         UntypedResultSet resultSet = execute("SELECT min(ttl(b)), ttl(b) FROM %s");
         assertEquals(1, resultSet.size());
         Row row = resultSet.one();
-        assertTrue(row.getInt("ttl(b)") > 4);
-        assertTrue(row.getInt("system.min(ttl(b))") <= 2);
+        assertTrue(row.getInt("ttl(b)") > (10 * secondsPerMinute));
+        assertTrue(row.getInt("system.min(ttl(b))") <= (10 * secondsPerMinute));
 
         resultSet = execute("SELECT min(writetime(b)), writetime(b) FROM %s");
         assertEquals(1, resultSet.size());