This is an automated email from the ASF dual-hosted git repository.

snazy pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 7f0df2e  Fix flaky CustomNowInSecondsTest.testSelectQuery()
7f0df2e is described below

commit 7f0df2e5e55ccad7ae23ed74e3caabba53d63d5e
Author: Robert Stupp <[email protected]>
AuthorDate: Thu Apr 23 13:55:42 2020 +0200

    Fix flaky CustomNowInSecondsTest.testSelectQuery()
    
    patch by Robert Stupp; reviewed by Andrés de la Peña for CASSANDRA-15751
---
 test/unit/org/apache/cassandra/cql3/CustomNowInSecondsTest.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/unit/org/apache/cassandra/cql3/CustomNowInSecondsTest.java 
b/test/unit/org/apache/cassandra/cql3/CustomNowInSecondsTest.java
index f013fc0..983acfa 100644
--- a/test/unit/org/apache/cassandra/cql3/CustomNowInSecondsTest.java
+++ b/test/unit/org/apache/cassandra/cql3/CustomNowInSecondsTest.java
@@ -54,7 +54,6 @@ public class CustomNowInSecondsTest extends CQLTester
 
     private void testSelectQuery(boolean prepared)
     {
-        int now = (int) (System.currentTimeMillis() / 1000);
         int day = 86400;
 
         String ks = createKeyspace("CREATE KEYSPACE %s WITH replication={ 
'class' : 'SimpleStrategy', 'replication_factor' : 1 }");
@@ -63,6 +62,8 @@ public class CustomNowInSecondsTest extends CQLTester
         // insert a row with TTL = 1 day.
         executeModify(format("INSERT INTO %s.%s (id, val) VALUES (0, 0) USING 
TTL %d", ks, tbl, day), Integer.MIN_VALUE, prepared);
 
+        int now = (int) (System.currentTimeMillis() / 1000);
+
         // execute a SELECT query without overriding nowInSeconds - make sure 
we observe one row.
         assertEquals(1, executeSelect(format("SELECT * FROM %s.%s", ks, tbl), 
Integer.MIN_VALUE, prepared).size());
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to