forked from apache/cassandra-python-driver
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathtest_concurrent_schema_change_and_node_kill.py
More file actions
36 lines (29 loc) · 1.29 KB
/
test_concurrent_schema_change_and_node_kill.py
File metadata and controls
36 lines (29 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
import logging
import unittest
from tests.integration import use_cluster, get_node, local, TestCluster
LOGGER = logging.getLogger(__name__)
def setup_module():
use_cluster('test_schema_kill', [3], start=True)
@local
class TestConcurrentSchemaChangeAndNodeKill(unittest.TestCase):
@classmethod
def setup_class(cls):
cls.cluster = TestCluster(max_schema_agreement_wait=120)
cls.session = cls.cluster.connect()
@classmethod
def teardown_class(cls):
cls.cluster.shutdown()
def test_schema_change_after_node_kill(self):
node2 = get_node(2)
self.session.execute(
"DROP KEYSPACE IF EXISTS ks_deadlock;")
self.session.execute(
"CREATE KEYSPACE IF NOT EXISTS ks_deadlock "
"WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '2' };")
self.session.set_keyspace('ks_deadlock')
self.session.execute("CREATE TABLE IF NOT EXISTS some_table(k int, c int, v int, PRIMARY KEY (k, v));")
self.session.execute("INSERT INTO some_table (k, c, v) VALUES (1, 2, 3);")
node2.stop(wait=False, gently=False)
self.session.execute("ALTER TABLE some_table ADD v2 int;", timeout=180)
print(self.session.execute("SELECT * FROM some_table WHERE k = 1;").all())