Skip to content
Permalink
Browse files
Ninja fix, add @SInCE('4.0') for transient replication tests
  • Loading branch information
aweisberg committed Sep 18, 2018
1 parent 0d9c98e commit 97529ccfb338a986c6ca596d4e989dbf53a05551
Showing 2 changed files with 14 additions and 24 deletions.
@@ -10,11 +10,13 @@

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 new_start(self, *args, **kwargs):

startable.start = types.MethodType(new_start, startable)


@since('4.0')
class TestTransientReplicationRing(Tester):

keyspace = "ks"
@@ -125,14 +129,9 @@ def setup_cluster(self, fixture_dtest_setup):

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 @@ def insert_row(self, pk, ck, value, session=None, node=None):
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 @@ def move_test(self, move_token, expected_after_move, expected_after_repair):
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 @@ def test_decommission(self):
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 @@ def test_remove(self):
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 @@ def test_remove(self):
@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)
@@ -10,15 +10,14 @@
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 uuid_or_none(s):
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 @@ def split(self, arr):
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 @@ def test_disabled_read_repair(self):
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 @@ def test_custom_speculate(self):
[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)

0 comments on commit 97529cc

Please sign in to comment.