Add schema disagreement checks
This commit is contained in:
@@ -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):
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user