forked from scylladb/scylla-cluster-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maintenance_test.py
63 lines (53 loc) · 1.98 KB
/
maintenance_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
#!/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) 2016 ScyllaDB
import time
from sdcm.tester import ClusterTester
from sdcm.nemesis import DrainerMonkey
from sdcm.nemesis import CorruptThenRepairMonkey
from sdcm.nemesis import CorruptThenRebuildMonkey
from sdcm.utils.common import skip_optional_stage
class MaintainanceTest(ClusterTester):
"""
Test a Scylla cluster maintenance operations.
"""
def _base_procedure(self, nemesis_class):
if not skip_optional_stage('main_load'):
cs_thread_pool = self.run_stress_thread(stress_cmd=self.params.get('stress_cmd'),
duration=240)
self.db_cluster.wait_total_space_used_per_node()
self.db_cluster.add_nemesis(nemesis=nemesis_class,
tester_obj=self)
# Wait another 10 minutes
time.sleep(10 * 60)
self.db_cluster.start_nemesis(interval=10)
time.sleep(180 * 60)
if not skip_optional_stage('main_load'):
# Kill c-s when done
self.kill_stress_thread()
self.verify_stress_thread(cs_thread_pool=cs_thread_pool)
def test_drain(self):
"""
Drain a node an restart it.
"""
self._base_procedure(DrainerMonkey)
def test_repair(self):
"""
Repair a node
"""
self._base_procedure(CorruptThenRepairMonkey)
def test_rebuild(self):
"""
Rebuild all nodes
"""
self._base_procedure(CorruptThenRebuildMonkey)