lukasz-antoniak commented on code in PR #1781:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1781#discussion_r1792083946


##########
batch_test.go:
##########
@@ -84,3 +84,68 @@ func TestBatch_WithTimestamp(t *testing.T) {
                t.Errorf("got ts %d, expected %d", storedTs, micros)
        }
 }
+
+func TestQuery_WithNowInSeconds(t *testing.T) {
+       session := createSession(t)
+       defer session.Close()
+
+       if session.cfg.ProtoVersion < protoVersion5 {
+               t.Skip("Query now in seconds are only available on protocol >= 
5")
+       }
+
+       if err := createTable(session, `CREATE TABLE query_now_in_seconds (id 
int primary key, val text)`); err != nil {
+               t.Fatal(err)
+       }
+
+       // Using 30 minutes ago timestamp as a starting point for TTL
+       seconds := time.Now().Add(-time.Minute*30).UnixMicro() / 1e6
+
+       err := session.
+               Query("INSERT INTO query_now_in_seconds (id, val) VALUES (?, ?) 
USING TTL 3600", 1, "val").
+               WithNowInSeconds(int(seconds)).
+               Exec()
+       if err != nil {
+               t.Fatal(err)
+       }
+
+       var ttl int64
+       if err := session.Query(`SELECT TTL(val) FROM query_now_in_seconds 
WHERE id = ?`, 1).Scan(&ttl); err != nil {
+               t.Fatal(err)
+       }
+
+       if ttl > 1800 {

Review Comment:
   This has been addressed in #1822.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to