You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by if...@apache.org on 2022/01/11 18:41:12 UTC

[cassandra-dtest] branch trunk updated: Fix flaky test: repair_tests/repair_test.py::TestRepair::test_local_d… (#161)

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

ifesdjeen 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 27c6d02  Fix flaky test: repair_tests/repair_test.py::TestRepair::test_local_d… (#161)
27c6d02 is described below

commit 27c6d022c2d7c197be03c7d6ebe22861ca66a04d
Author: Alex Petrov <ol...@gmail.com>
AuthorDate: Tue Jan 11 19:41:07 2022 +0100

    Fix flaky test: repair_tests/repair_test.py::TestRepair::test_local_d… (#161)
    
    Patch by Alex Petrov; reviewed by Caleb Rackliffe for CASSANDRA-16963
---
 repair_tests/repair_test.py | 12 ++++++------
 tools/data.py               |  7 +++++--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/repair_tests/repair_test.py b/repair_tests/repair_test.py
index ddae777..bad9550 100644
--- a/repair_tests/repair_test.py
+++ b/repair_tests/repair_test.py
@@ -109,12 +109,12 @@ class BaseRepairTest(Tester):
 
         # Insert 1000 keys, kill node 3, insert 1 key, restart node 3, insert 1000 more keys
         logger.debug("Inserting data...")
-        insert_c1c2(session, n=1000, consistency=ConsistencyLevel.ALL)
+        insert_c1c2(session, n=1000, consistency=ConsistencyLevel.ALL, ks='ks')
         node3.flush()
         node3.stop(wait_other_notice=True)
-        insert_c1c2(session, keys=(1000, ), consistency=ConsistencyLevel.TWO)
+        insert_c1c2(session, keys=(1000, ), consistency=ConsistencyLevel.TWO, ks='ks')
         node3.start(wait_for_binary_proto=True)
-        insert_c1c2(session, keys=list(range(1001, 2001)), consistency=ConsistencyLevel.ALL)
+        insert_c1c2(session, keys=list(range(1001, 2001)), consistency=ConsistencyLevel.ALL, ks='ks')
 
         cluster.flush()
 
@@ -734,13 +734,13 @@ class TestRepair(BaseRepairTest):
 
         # Insert 1000 keys, kill node 2, insert 1 key, restart node 2, insert 1000 more keys
         logger.debug("Inserting data...")
-        insert_c1c2(session, n=1000, consistency=ConsistencyLevel.ALL)
+        insert_c1c2(session, n=1000, consistency=ConsistencyLevel.ALL, ks='ks')
         node2.flush()
         node2.stop(wait_other_notice=True)
-        insert_c1c2(session, keys=(1000, ), consistency=ConsistencyLevel.THREE)
+        insert_c1c2(session, keys=(1000, ), consistency=ConsistencyLevel.THREE, ks='ks')
         node2.start(wait_for_binary_proto=True)
         node1.watch_log_for_alive(node2)
-        insert_c1c2(session, keys=list(range(1001, 2001)), consistency=ConsistencyLevel.ALL)
+        insert_c1c2(session, keys=list(range(1001, 2001)), consistency=ConsistencyLevel.ALL, ks='ks')
 
         cluster.flush()
 
diff --git a/tools/data.py b/tools/data.py
index 0ba22ac..d38ffd9 100644
--- a/tools/data.py
+++ b/tools/data.py
@@ -17,7 +17,7 @@ def create_c1c2_table(tester, session, read_repair=None):
     create_cf(session, 'cf', columns={'c1': 'text', 'c2': 'text'}, read_repair=read_repair)
 
 
-def insert_c1c2(session, keys=None, n=None, consistency=ConsistencyLevel.QUORUM):
+def insert_c1c2(session, ks=None, keys=None, n=None, consistency=ConsistencyLevel.QUORUM):
     if (keys is None and n is None) or (keys is not None and n is not None):
         raise ValueError("Expected exactly one of 'keys' or 'n' arguments to not be None; "
                          "got keys={keys}, n={n}".format(keys=keys, n=n))
@@ -27,7 +27,10 @@ def insert_c1c2(session, keys=None, n=None, consistency=ConsistencyLevel.QUORUM)
         else:
             keys = range(n)
 
-    statement = session.prepare("INSERT INTO cf (key, c1, c2) VALUES (?, 'value1', 'value2')")
+    fully_qualified_cf = "cf"
+    if ((ks is not None) and (not (not ks))):
+        fully_qualified_cf = "{ks}.cf".format(ks=ks)
+    statement = session.prepare("INSERT INTO {fully_qualified_cf} (key, c1, c2) VALUES (?, 'value1', 'value2')".format(fully_qualified_cf=fully_qualified_cf))
     statement.consistency_level = consistency
 
     execute_concurrent_with_args(session, statement, [['k{}'.format(k)] for k in keys])

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