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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new 7d5c1ca4 Update tests for new snake case function name conventions
7d5c1ca4 is described below

commit 7d5c1ca42e92121b971f60ad875fb8f11d07f730
Author: Andrés de la Peña <a.penya.gar...@gmail.com>
AuthorDate: Tue Mar 21 13:52:09 2023 +0000

    Update tests for new snake case function name conventions
    
    patch by Andrés de la Peña; reviewed by Berenguer Blasi for CASSANDRA-18037
---
 materialized_views_test.py |  7 ++++++-
 upgrade_tests/cql_tests.py | 20 +++++++++++++++-----
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/materialized_views_test.py b/materialized_views_test.py
index b859ed66..a44f6742 100644
--- a/materialized_views_test.py
+++ b/materialized_views_test.py
@@ -2981,9 +2981,14 @@ class TestMaterializedViewsLockcontention(Tester):
             for y in range(records2):
                 params.append([x, y])
 
+        if self.cluster.version() < LooseVersion('5.0'):
+            insert = 'INSERT INTO test (int1, int2, date) VALUES (?, ?, 
toTimestamp(now()))'
+        else:
+            insert = 'INSERT INTO test (int1, int2, date) VALUES (?, ?, 
to_timestamp(now()))'
+
         execute_concurrent_with_args(
             session,
-            session.prepare('INSERT INTO test (int1, int2, date) VALUES (?, ?, 
toTimestamp(now()))'),
+            session.prepare(insert),
             params
         )
 
diff --git a/upgrade_tests/cql_tests.py b/upgrade_tests/cql_tests.py
index 3147c7b5..cb5e1030 100644
--- a/upgrade_tests/cql_tests.py
+++ b/upgrade_tests/cql_tests.py
@@ -2652,17 +2652,27 @@ class TestCQL(UpgradeTester):
 
             assert_row_count(cursor, 'test', 1, where="k = 0 AND t = 
{}".format(dates[0]))
 
+            # test function with deprecated pre-5.0 names
+            # not sure what to check exactly so just checking the query returns
             assert_invalid(cursor, "SELECT minTimeuuid(k) FROM test WHERE k = 
0 AND t = %s" % dates[0])
-
+            cursor.execute("SELECT t FROM test WHERE k = 0"
+                           " AND t > maxTimeuuid(1234567)"
+                           " AND t < minTimeuuid('2012-11-07 18:18:22-0800')")
             if self.get_node_version(is_upgraded) >= LooseVersion('2.2'):
                 cursor.execute("SELECT toTimestamp(t), toUnixTimestamp(t) FROM 
test WHERE k = 0 AND t = %s" % dates[0])
 
-            if self.get_node_version(is_upgraded) < LooseVersion('5.0'):
+            # test function with new post-5.0 names
+            if self.get_node_version(is_upgraded) >= LooseVersion('5.0'):
+                assert_invalid(cursor, "SELECT min_timeuuid(k) FROM test WHERE 
k = 0 AND t = %s" % dates[0])
+                cursor.execute("SELECT t FROM test WHERE k = 0"
+                               " AND t > max_timeuuid(1234567)"
+                               " AND t < min_timeuuid('2012-11-07 
18:18:22-0800')")
+                cursor.execute("SELECT to_timestamp(t), to_unix_timestamp(t) 
FROM test WHERE k = 0 AND t = %s"
+                               % dates[0])
+            # test functions removed in 5.0
+            else:
                 cursor.execute("SELECT dateOf(t), unixTimestampOf(t) FROM test 
WHERE k = 0 AND t = %s" % dates[0])
 
-            cursor.execute("SELECT t FROM test WHERE k = 0 AND t > 
maxTimeuuid(1234567) AND t < minTimeuuid('2012-11-07 18:18:22-0800')")
-            # not sure what to check exactly so just checking the query returns
-
     def test_float_with_exponent(self):
         cursor = self.prepare()
 


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

Reply via email to