forked from scylladb/scylla-cluster-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
partial_upgrade_downgrade_test.py
75 lines (57 loc) · 2.44 KB
/
partial_upgrade_downgrade_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
#!/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
from avocado import main
from sdcm.tester import ClusterTester
from sdcm.data_path import get_data_path
from sdcm.nemesis import UpgradeNemesis
from sdcm.nemesis import log_time_elapsed
class PartialUpgradeDowngradeNemesis(UpgradeNemesis):
# downgrade a single node
def downgrade_node(self, node):
self.log.info('Downgrading a Node')
scylla_repo = get_data_path('scylla.repo.downgrade')
node.remoter.send_files(scylla_repo, '/tmp/scylla.repo', verbose=True)
node.remoter.run('sudo cp /tmp/scylla.repo /etc/yum.repos.d/scylla.repo')
node.remoter.run('sudo chown root.root /etc/yum.repos.d/scylla.repo')
node.remoter.run('sudo chmod 644 /etc/yum.repos.d/scylla.repo')
node.remoter.run('sudo yum clean all')
node.remoter.run('sudo yum downgrade scylla scylla-conf scylla-server scylla-jmx scylla-tools -y')
node.remoter.run('sudo systemctl restart scylla-server.service')
node.wait_db_up(verbose=True)
@log_time_elapsed
def disrupt(self):
self.log.info('PartialUpgradeDowngrade Nemesis begin')
# Upgrade first node
node = self.cluster.nodes[0]
self.upgrade_node(node)
# then downgrade it
self.downgrade_node(node)
self.log.info('PartialUpgradeDowngrade Nemesis end')
class PartialUpgradeDowngradeTest(ClusterTester):
"""
Test a Scylla cluster upgrade.
:avocado: enable
"""
default_params = {'timeout': 650000}
def test_20_minutes(self):
"""
Run cassandra-stress on a cluster for 20 minutes, together with node upgrades.
"""
self.db_cluster.add_nemesis(nemesis=PartialUpgradeDowngradeNemesis,
loaders=self.loaders,
monitoring_set=self.monitors)
self.db_cluster.start_nemesis(interval=10)
self.run_stress(duration=20)
if __name__ == '__main__':
main()