-
Notifications
You must be signed in to change notification settings - Fork 95
/
multiple_dc_test.py
87 lines (66 loc) · 2.93 KB
/
multiple_dc_test.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# Copyright (c) 2017 ScyllaDB
# TODO: this test seem to be broken, hence disabling all pylint checks
# pylint: disable=all
# ruff: noqa: F821
from sdcm.tester import ClusterTester
class MultipleDcTest(ClusterTester):
"""
Test with multiple DataCenters
"""
def stop_scylla(self, node):
node.stop_scylla(verify_up=True, verify_down=True)
def start_scylla(self, node):
node.start_scylla(verify_up=True, verify_down=True)
def test_shutdown(self):
"""
https://github.com/scylladb/scylla-enterprise/issues/228
"""
# run a background workload
stress_queue = self.run_stress_thread(stress_cmd=self.params.get('stress_cmd'),
stress_num=2,
keyspace_num=1)
nodes = self.db_cluster.nodes
# add a new node to existing cluster
new_node = self.add_node(1)[0]
# stop old node
old_node = nodes[-1]
old_node.stop_scylla(verify_up=True, verify_down=True)
# stop new node
new_node.stop_scylla(verify_up=True, verify_down=True)
# restart the service
old_node.start_scylla(verify_up=True, verify_down=True)
new_node.start_scylla(verify_up=True, verify_down=True)
self.get_stress_results(queue=stress_queue)
def test_series_stop(self):
# run a background workload
stress_queue = self.run_stress_thread(stress_cmd=self.params.get('stress_cmd'),
stress_num=2,
keyspace_num=1)
nodes_2nd_dc = [n for n in node_list if n.dc_idx == 1]
for node in nodes_2nd_dc:
node.stop_scylla(verify_up=True, verify_down=True)
for node in nodes_2nd_dc:
node.start_scylla(verify_up=True, verify_down=True)
self.get_stress_results(queue=stress_queue)
def test_parallel_stop(self):
# run a background workload
self.run_stress_thread(stress_cmd=self.params.get('stress_cmd'),
stress_num=2,
keyspace_num=1)
nodes_2nd_dc = [n for n in node_list if n.dc_idx == 1]
# stop the services of 2nd dc in parallel
self.run_func_parallel(self.stop_scylla, node_list=nodes_2nd_dc)
# restart the services in parallel
self.run_func_parallel(self.start_scylla, node_list=nodes_2nd_dc)