You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by aw...@apache.org on 2018/09/18 17:52:09 UTC

cassandra-dtest git commit: Ninja fix, add @since('4.0') for transient replication tests

Repository: cassandra-dtest
Updated Branches:
  refs/heads/master 0d9c98ee1 -> 97529ccfb


Ninja fix, add @since('4.0') for transient replication tests


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

Branch: refs/heads/master
Commit: 97529ccfb338a986c6ca596d4e989dbf53a05551
Parents: 0d9c98e
Author: Ariel Weisberg <aw...@apple.com>
Authored: Tue Sep 18 13:51:46 2018 -0400
Committer: Ariel Weisberg <aw...@apple.com>
Committed: Tue Sep 18 13:51:46 2018 -0400

----------------------------------------------------------------------
 transient_replication_ring_test.py | 27 ++++++++-------------------
 transient_replication_test.py      | 11 ++++++-----
 2 files changed, 14 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/97529ccf/transient_replication_ring_test.py
----------------------------------------------------------------------
diff --git a/transient_replication_ring_test.py b/transient_replication_ring_test.py
index a3b596e..feea876 100644
--- a/transient_replication_ring_test.py
+++ b/transient_replication_ring_test.py
@@ -10,11 +10,13 @@ from tools.assertions import (assert_all)
 
 from flaky import flaky
 
-from cassandra.metadata import BytesToken, OrderedDict
+from cassandra.metadata import OrderedDict
 import pytest
 from itertools import chain
 from tools.misc import new_node
 
+since = pytest.mark.since
+
 logging.getLogger('cassandra').setLevel(logging.CRITICAL)
 
 NODELOCAL = 11
@@ -46,6 +48,8 @@ def patch_start(startable):
 
     startable.start = types.MethodType(new_start, startable)
 
+
+@since('4.0')
 class TestTransientReplicationRing(Tester):
 
     keyspace = "ks"
@@ -125,14 +129,9 @@ class TestTransientReplicationRing(Tester):
 
         session.execute("CREATE KEYSPACE %s WITH REPLICATION={%s}" % (self.keyspace, replication_params))
         print("CREATE KEYSPACE %s WITH REPLICATION={%s}" % (self.keyspace, replication_params))
-        self.create_table(session)
-
-    def create_table(self, session, never_speculate=False):
-        if never_speculate:
-            session.execute("CREATE TABLE %s.%s (pk varchar, ck int, value int, PRIMARY KEY (pk, ck)) WITH speculative_retry = 'NEVER' AND read_repair = 'NONE'" % (self.keyspace, self.table))
-        else:
-            session.execute("CREATE TABLE %s.%s (pk varchar, ck int, value int, PRIMARY KEY (pk, ck)) WITH read_repair = 'NONE'" % (self.keyspace, self.table))
-        print(str(self.node1.run_cqlsh("describe table %s.%s" % (self.keyspace, self.table))))
+        session.execute(
+            "CREATE TABLE %s.%s (pk varchar, ck int, value int, PRIMARY KEY (pk, ck)) WITH speculative_retry = 'NEVER' AND speculative_write_threshold = 'NEVER' AND read_repair = 'NONE'" % (
+            self.keyspace, self.table))
 
     def quorum(self, session, stmt_str):
         return session.execute(SimpleStatement(stmt_str, consistency_level=ConsistencyLevel.QUORUM))
@@ -150,8 +149,6 @@ class TestTransientReplicationRing(Tester):
     def test_bootstrap_and_cleanup(self):
         """Test bootstrapping a new node across a mix of repaired and unrepaired data"""
         main_session = self.patient_cql_connection(self.node1)
-        self.table = 'tbl2'
-        self.create_table(main_session, never_speculate=True)
         nodes = [self.node1, self.node2, self.node3]
 
         for i in range(0, 40, 2):
@@ -232,8 +229,6 @@ class TestTransientReplicationRing(Tester):
         patch_start(node4)
         node4.start(wait_for_binary_proto=True, wait_other_notice=True)
         main_session = self.patient_cql_connection(self.node1)
-        self.table = 'tbl2'
-        self.create_table(main_session, never_speculate=True)
         nodes = [self.node1, self.node2, self.node3, node4]
 
         for i in range(0, 40, 2):
@@ -345,8 +340,6 @@ class TestTransientReplicationRing(Tester):
         patch_start(node4)
         node4.start(wait_for_binary_proto=True, wait_other_notice=True)
         main_session = self.patient_cql_connection(self.node1)
-        self.table = 'tbl2'
-        self.create_table(main_session, never_speculate=True)
         nodes = [self.node1, self.node2, self.node3, node4]
 
         for i in range(0, 40, 2):
@@ -408,8 +401,6 @@ class TestTransientReplicationRing(Tester):
         patch_start(node4)
         node4.start(wait_for_binary_proto=True, wait_other_notice=True)
         main_session = self.patient_cql_connection(self.node1)
-        self.table = 'tbl2'
-        self.create_table(main_session, never_speculate=True)
         nodes = [self.node1, self.node2, self.node3]
 
         #We want the node being removed to have no data on it so nodetool remove always gets all the necessary data
@@ -457,8 +448,6 @@ class TestTransientReplicationRing(Tester):
     @pytest.mark.no_vnodes
     def test_replace(self):
         main_session = self.patient_cql_connection(self.node1)
-        self.table = 'tbl2'
-        self.create_table(main_session, never_speculate=True)
 
         #We want the node being replaced to have no data on it so the replacement definitely fetches all the data
         self.node2.stop(wait_other_notice=True)

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/97529ccf/transient_replication_test.py
----------------------------------------------------------------------
diff --git a/transient_replication_test.py b/transient_replication_test.py
index 0571678..8e47add 100644
--- a/transient_replication_test.py
+++ b/transient_replication_test.py
@@ -10,15 +10,14 @@ from cassandra.protocol import ConfigurationException
 from ccmlib.node import Node
 
 from dtest import Tester
-from tools.misc import ImmutableMapping
 from tools.jmxutils import JolokiaAgent, make_mbean
 from tools.data import rows_to_list
-from tools.assertions import (assert_all, assert_invalid, assert_length_equal,
-                              assert_none, assert_one, assert_unavailable)
+from tools.assertions import (assert_all)
 
 from cassandra.metadata import Murmur3Token, OrderedDict
 import pytest
 
+since = pytest.mark.since
 
 logging.getLogger('cassandra').setLevel(logging.CRITICAL)
 
@@ -161,7 +160,7 @@ def get_sstable_data(cls, node, keyspace):
     assert len(names) == len(repaired_times) == len(pending_repairs)
     return [SSTable(*a) for a in zip(names, repaired_times, pending_repairs)]
 
-
+@since('4.0')
 class TransientReplicationBase(Tester):
 
     keyspace = "ks"
@@ -278,7 +277,7 @@ class TransientReplicationBase(Tester):
     def generate_rows(self, partitions, rows):
         return [[pk, ck, pk+ck] for ck in range(rows) for pk in range(partitions)]
 
-
+@since('4.0')
 class TestTransientReplication(TransientReplicationBase):
 
     @pytest.mark.no_vnodes
@@ -560,6 +559,7 @@ class TestTransientReplication(TransientReplicationBase):
             session.execute("ALTER TABLE %s.%s WITH read_repair = 'BLOCKING'" % (self.keyspace, self.table))
 
 
+@since('4.0')
 class TestTransientReplicationSpeculativeQueries(TransientReplicationBase):
     def setup_schema(self):
         session = self.exclusive_cql_connection(self.node1)
@@ -604,6 +604,7 @@ class TestTransientReplicationSpeculativeQueries(TransientReplicationBase):
                         [1, 2, 2]],
                        cl=ConsistencyLevel.QUORUM)
 
+@since('4.0')
 class TestMultipleTransientNodes(TransientReplicationBase):
     def populate(self):
         self.cluster.populate(5, tokens=self.tokens, debug=True, install_byteman=True)


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