Add schema disagreement checks

This commit is contained in:
Joaquin Casares
2014-04-25 19:23:18 -05:00
parent 01bfd3c477
commit 1d2d810d66
2 changed files with 56 additions and 2 deletions

View File

@@ -36,7 +36,7 @@ except ImportError as e:
CLUSTER_NAME = 'test_cluster'
MULTIDC_CLUSTER_NAME = 'multidc_test_cluster'
CCM_CLUSTER = None
DEFAULT_CASSANDRA_VERSION = '1.2.15'
DEFAULT_CASSANDRA_VERSION = '1.2.16'
path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'ccm')
if not os.path.exists(path):

View File

@@ -14,7 +14,7 @@
import logging
from cassandra import ConsistencyLevel
from cassandra import ConsistencyLevel, OperationTimedOut
from cassandra.cluster import Cluster
from cassandra.query import SimpleStatement
@@ -63,3 +63,57 @@ class SchemaTests(unittest.TestCase):
ss = SimpleStatement(statement,
consistency_level=ConsistencyLevel.QUORUM)
session.execute(ss)
def test_for_schema_disagreements_different_keyspaces(self):
cluster = Cluster()
session = cluster.connect()
for i in xrange(30):
try:
session.execute('''
CREATE KEYSPACE test_%s
WITH replication = {'class': 'SimpleStrategy',
'replication_factor': 1}
''' % i)
session.execute('''
CREATE TABLE test_%s.cf (
key int,
value int,
PRIMARY KEY (key))
''' % i)
for j in xrange(100):
session.execute('INSERT INTO test_%s.cf (key, value) VALUES (%s, %s)' % (i, j, j))
session.execute('''
DROP KEYSPACE test_%s
''' % i)
except OperationTimedOut: pass
def test_for_schema_disagreements_same_keyspace(self):
cluster = Cluster()
session = cluster.connect()
for i in xrange(30):
try:
session.execute('''
CREATE KEYSPACE test
WITH replication = {'class': 'SimpleStrategy',
'replication_factor': 1}
''')
session.execute('''
CREATE TABLE test.cf (
key int,
value int,
PRIMARY KEY (key))
''')
for j in xrange(100):
session.execute('INSERT INTO test.cf (key, value) VALUES (%s, %s)' % (j, j))
session.execute('''
DROP KEYSPACE test
''')
except OperationTimedOut: pass