teuthology 1.0.0__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scripts/describe.py +1 -0
- scripts/dispatcher.py +62 -0
- scripts/exporter.py +18 -0
- scripts/lock.py +1 -1
- scripts/node_cleanup.py +58 -0
- scripts/openstack.py +9 -9
- scripts/results.py +12 -11
- scripts/run.py +4 -0
- scripts/schedule.py +4 -0
- scripts/suite.py +61 -16
- scripts/supervisor.py +44 -0
- scripts/update_inventory.py +10 -4
- scripts/wait.py +31 -0
- teuthology/__init__.py +24 -21
- teuthology/beanstalk.py +4 -3
- teuthology/config.py +17 -6
- teuthology/contextutil.py +18 -14
- teuthology/describe_tests.py +25 -18
- teuthology/dispatcher/__init__.py +365 -0
- teuthology/dispatcher/supervisor.py +374 -0
- teuthology/exceptions.py +54 -0
- teuthology/exporter.py +347 -0
- teuthology/kill.py +76 -75
- teuthology/lock/cli.py +16 -7
- teuthology/lock/ops.py +276 -70
- teuthology/lock/query.py +61 -44
- teuthology/ls.py +9 -18
- teuthology/misc.py +152 -137
- teuthology/nuke/__init__.py +12 -351
- teuthology/openstack/__init__.py +4 -3
- teuthology/openstack/openstack-centos-7.0-user-data.txt +1 -1
- teuthology/openstack/openstack-centos-7.1-user-data.txt +1 -1
- teuthology/openstack/openstack-centos-7.2-user-data.txt +1 -1
- teuthology/openstack/openstack-debian-8.0-user-data.txt +1 -1
- teuthology/openstack/openstack-opensuse-42.1-user-data.txt +1 -1
- teuthology/openstack/openstack-teuthology.cron +0 -1
- teuthology/orchestra/cluster.py +51 -9
- teuthology/orchestra/connection.py +23 -16
- teuthology/orchestra/console.py +111 -50
- teuthology/orchestra/daemon/cephadmunit.py +23 -5
- teuthology/orchestra/daemon/state.py +10 -3
- teuthology/orchestra/daemon/systemd.py +10 -8
- teuthology/orchestra/opsys.py +32 -11
- teuthology/orchestra/remote.py +369 -152
- teuthology/orchestra/run.py +21 -12
- teuthology/packaging.py +54 -15
- teuthology/provision/__init__.py +30 -10
- teuthology/provision/cloud/openstack.py +12 -6
- teuthology/provision/cloud/util.py +1 -2
- teuthology/provision/downburst.py +83 -29
- teuthology/provision/fog.py +68 -20
- teuthology/provision/openstack.py +5 -4
- teuthology/provision/pelagos.py +13 -5
- teuthology/repo_utils.py +91 -44
- teuthology/report.py +57 -35
- teuthology/results.py +5 -3
- teuthology/run.py +21 -15
- teuthology/run_tasks.py +114 -40
- teuthology/schedule.py +4 -3
- teuthology/scrape.py +28 -22
- teuthology/suite/__init__.py +75 -46
- teuthology/suite/build_matrix.py +34 -24
- teuthology/suite/fragment-merge.lua +105 -0
- teuthology/suite/matrix.py +31 -2
- teuthology/suite/merge.py +175 -0
- teuthology/suite/placeholder.py +8 -8
- teuthology/suite/run.py +204 -102
- teuthology/suite/util.py +67 -211
- teuthology/task/__init__.py +1 -1
- teuthology/task/ansible.py +101 -31
- teuthology/task/buildpackages.py +2 -2
- teuthology/task/ceph_ansible.py +13 -6
- teuthology/task/cephmetrics.py +2 -1
- teuthology/task/clock.py +33 -14
- teuthology/task/exec.py +18 -0
- teuthology/task/hadoop.py +2 -2
- teuthology/task/install/__init__.py +51 -22
- teuthology/task/install/bin/adjust-ulimits +16 -0
- teuthology/task/install/bin/daemon-helper +114 -0
- teuthology/task/install/bin/stdin-killer +263 -0
- teuthology/task/install/deb.py +24 -4
- teuthology/task/install/redhat.py +36 -32
- teuthology/task/install/rpm.py +41 -14
- teuthology/task/install/util.py +48 -22
- teuthology/task/internal/__init__.py +69 -11
- teuthology/task/internal/edit_sudoers.sh +10 -0
- teuthology/task/internal/lock_machines.py +3 -133
- teuthology/task/internal/redhat.py +48 -28
- teuthology/task/internal/syslog.py +31 -8
- teuthology/task/kernel.py +155 -147
- teuthology/task/lockfile.py +1 -1
- teuthology/task/mpi.py +10 -10
- teuthology/task/pcp.py +1 -1
- teuthology/task/selinux.py +17 -8
- teuthology/task/ssh_keys.py +6 -6
- teuthology/task/tests/__init__.py +137 -77
- teuthology/task/tests/test_fetch_coredumps.py +116 -0
- teuthology/task/tests/test_run.py +4 -4
- teuthology/timer.py +3 -3
- teuthology/util/loggerfile.py +19 -0
- teuthology/util/scanner.py +159 -0
- teuthology/util/sentry.py +52 -0
- teuthology/util/time.py +52 -0
- teuthology-1.2.0.data/scripts/adjust-ulimits +16 -0
- teuthology-1.2.0.data/scripts/daemon-helper +114 -0
- teuthology-1.2.0.data/scripts/stdin-killer +263 -0
- teuthology-1.2.0.dist-info/METADATA +89 -0
- teuthology-1.2.0.dist-info/RECORD +174 -0
- {teuthology-1.0.0.dist-info → teuthology-1.2.0.dist-info}/WHEEL +1 -1
- {teuthology-1.0.0.dist-info → teuthology-1.2.0.dist-info}/entry_points.txt +5 -2
- scripts/nuke.py +0 -45
- scripts/worker.py +0 -37
- teuthology/nuke/actions.py +0 -456
- teuthology/openstack/test/__init__.py +0 -0
- teuthology/openstack/test/openstack-integration.py +0 -286
- teuthology/openstack/test/test_config.py +0 -35
- teuthology/openstack/test/test_openstack.py +0 -1695
- teuthology/orchestra/test/__init__.py +0 -0
- teuthology/orchestra/test/integration/__init__.py +0 -0
- teuthology/orchestra/test/integration/test_integration.py +0 -94
- teuthology/orchestra/test/test_cluster.py +0 -240
- teuthology/orchestra/test/test_connection.py +0 -106
- teuthology/orchestra/test/test_console.py +0 -217
- teuthology/orchestra/test/test_opsys.py +0 -404
- teuthology/orchestra/test/test_remote.py +0 -185
- teuthology/orchestra/test/test_run.py +0 -286
- teuthology/orchestra/test/test_systemd.py +0 -54
- teuthology/orchestra/test/util.py +0 -12
- teuthology/sentry.py +0 -18
- teuthology/test/__init__.py +0 -0
- teuthology/test/fake_archive.py +0 -107
- teuthology/test/fake_fs.py +0 -92
- teuthology/test/integration/__init__.py +0 -0
- teuthology/test/integration/test_suite.py +0 -86
- teuthology/test/task/__init__.py +0 -205
- teuthology/test/task/test_ansible.py +0 -624
- teuthology/test/task/test_ceph_ansible.py +0 -176
- teuthology/test/task/test_console_log.py +0 -88
- teuthology/test/task/test_install.py +0 -337
- teuthology/test/task/test_internal.py +0 -57
- teuthology/test/task/test_kernel.py +0 -243
- teuthology/test/task/test_pcp.py +0 -379
- teuthology/test/task/test_selinux.py +0 -35
- teuthology/test/test_config.py +0 -189
- teuthology/test/test_contextutil.py +0 -68
- teuthology/test/test_describe_tests.py +0 -316
- teuthology/test/test_email_sleep_before_teardown.py +0 -81
- teuthology/test/test_exit.py +0 -97
- teuthology/test/test_get_distro.py +0 -47
- teuthology/test/test_get_distro_version.py +0 -47
- teuthology/test/test_get_multi_machine_types.py +0 -27
- teuthology/test/test_job_status.py +0 -60
- teuthology/test/test_ls.py +0 -48
- teuthology/test/test_misc.py +0 -368
- teuthology/test/test_nuke.py +0 -232
- teuthology/test/test_packaging.py +0 -763
- teuthology/test/test_parallel.py +0 -28
- teuthology/test/test_repo_utils.py +0 -204
- teuthology/test/test_report.py +0 -77
- teuthology/test/test_results.py +0 -155
- teuthology/test/test_run.py +0 -238
- teuthology/test/test_safepath.py +0 -55
- teuthology/test/test_schedule.py +0 -45
- teuthology/test/test_scrape.py +0 -167
- teuthology/test/test_timer.py +0 -80
- teuthology/test/test_vps_os_vers_parameter_checking.py +0 -84
- teuthology/test/test_worker.py +0 -303
- teuthology/worker.py +0 -339
- teuthology-1.0.0.dist-info/METADATA +0 -76
- teuthology-1.0.0.dist-info/RECORD +0 -210
- {teuthology-1.0.0.dist-info → teuthology-1.2.0.dist-info}/LICENSE +0 -0
- {teuthology-1.0.0.dist-info → teuthology-1.2.0.dist-info}/top_level.txt +0 -0
@@ -1,176 +0,0 @@
|
|
1
|
-
from mock import patch, MagicMock
|
2
|
-
from pytest import skip
|
3
|
-
from teuthology.util.compat import PY3
|
4
|
-
if PY3:
|
5
|
-
from io import StringIO as StringIO
|
6
|
-
else:
|
7
|
-
from io import BytesIO as StringIO
|
8
|
-
|
9
|
-
from teuthology.config import FakeNamespace
|
10
|
-
from teuthology.orchestra.cluster import Cluster
|
11
|
-
from teuthology.orchestra.remote import Remote
|
12
|
-
from teuthology.task import ceph_ansible
|
13
|
-
from teuthology.task.ceph_ansible import CephAnsible
|
14
|
-
|
15
|
-
from teuthology.test.task import TestTask
|
16
|
-
|
17
|
-
SKIP_IRRELEVANT = "Not relevant to this subclass"
|
18
|
-
|
19
|
-
|
20
|
-
class TestCephAnsibleTask(TestTask):
|
21
|
-
klass = CephAnsible
|
22
|
-
task_name = 'ceph_ansible'
|
23
|
-
|
24
|
-
def setup(self):
|
25
|
-
self.ctx = FakeNamespace()
|
26
|
-
self.ctx.cluster = Cluster()
|
27
|
-
self.ctx.cluster.add(Remote('user@remote1'), ['mon.0'])
|
28
|
-
self.ctx.cluster.add(Remote('user@remote2'), ['mds.0'])
|
29
|
-
self.ctx.cluster.add(Remote('user@remote3'), ['osd.0'])
|
30
|
-
self.ctx.summary = dict()
|
31
|
-
self.ctx.config = dict()
|
32
|
-
self.task_config = dict()
|
33
|
-
self.start_patchers()
|
34
|
-
|
35
|
-
def start_patchers(self):
|
36
|
-
m_fetch_repo = MagicMock()
|
37
|
-
m_fetch_repo.return_value = 'PATH'
|
38
|
-
|
39
|
-
def fake_get_scratch_devices(remote):
|
40
|
-
return ['/dev/%s' % remote.shortname]
|
41
|
-
|
42
|
-
self.patcher_get_scratch_devices = patch(
|
43
|
-
'teuthology.task.ceph_ansible.get_scratch_devices',
|
44
|
-
fake_get_scratch_devices,
|
45
|
-
)
|
46
|
-
self.patcher_get_scratch_devices.start()
|
47
|
-
|
48
|
-
self.patcher_teardown = patch(
|
49
|
-
'teuthology.task.ceph_ansible.CephAnsible.teardown',
|
50
|
-
)
|
51
|
-
self.patcher_teardown.start()
|
52
|
-
|
53
|
-
def fake_set_iface_and_cidr(self):
|
54
|
-
self._interface = 'eth0'
|
55
|
-
self._cidr = '172.21.0.0/20'
|
56
|
-
|
57
|
-
self.patcher_remote = patch.multiple(
|
58
|
-
Remote,
|
59
|
-
_set_iface_and_cidr=fake_set_iface_and_cidr,
|
60
|
-
)
|
61
|
-
self.patcher_remote.start()
|
62
|
-
|
63
|
-
def stop_patchers(self):
|
64
|
-
self.patcher_get_scratch_devices.stop()
|
65
|
-
self.patcher_remote.stop()
|
66
|
-
self.patcher_teardown.stop()
|
67
|
-
|
68
|
-
def test_playbook_none(self):
|
69
|
-
skip(SKIP_IRRELEVANT)
|
70
|
-
|
71
|
-
def test_inventory_none(self):
|
72
|
-
skip(SKIP_IRRELEVANT)
|
73
|
-
|
74
|
-
def test_inventory_path(self):
|
75
|
-
skip(SKIP_IRRELEVANT)
|
76
|
-
|
77
|
-
def test_inventory_etc(self):
|
78
|
-
skip(SKIP_IRRELEVANT)
|
79
|
-
|
80
|
-
def test_generate_hosts_file(self):
|
81
|
-
self.task_config.update(dict(
|
82
|
-
playbook=[],
|
83
|
-
vars=dict(
|
84
|
-
osd_auto_discovery=True,
|
85
|
-
monitor_interface='eth0',
|
86
|
-
radosgw_interface='eth0',
|
87
|
-
public_network='172.21.0.0/20',
|
88
|
-
),
|
89
|
-
))
|
90
|
-
task = self.klass(self.ctx, self.task_config)
|
91
|
-
hosts_file_path = '/my/hosts/file'
|
92
|
-
hosts_file_obj = StringIO()
|
93
|
-
hosts_file_obj.name = hosts_file_path
|
94
|
-
with patch.object(ceph_ansible, 'NamedTemporaryFile') as m_NTF:
|
95
|
-
m_NTF.return_value = hosts_file_obj
|
96
|
-
task.generate_hosts_file()
|
97
|
-
m_NTF.assert_called_once_with(prefix="teuth_ansible_hosts_",
|
98
|
-
mode='w+',
|
99
|
-
delete=False)
|
100
|
-
assert task.generated_inventory is True
|
101
|
-
assert task.inventory == hosts_file_path
|
102
|
-
hosts_file_obj.seek(0)
|
103
|
-
assert hosts_file_obj.read() == '\n'.join([
|
104
|
-
'[mdss]',
|
105
|
-
'remote2',
|
106
|
-
'',
|
107
|
-
'[mons]',
|
108
|
-
'remote1',
|
109
|
-
'',
|
110
|
-
'[osds]',
|
111
|
-
'remote3',
|
112
|
-
])
|
113
|
-
|
114
|
-
def test_generate_hosts_file_with_devices(self):
|
115
|
-
self.task_config.update(dict(
|
116
|
-
playbook=[],
|
117
|
-
vars=dict(
|
118
|
-
monitor_interface='eth0',
|
119
|
-
radosgw_interface='eth0',
|
120
|
-
public_network='172.21.0.0/20',
|
121
|
-
),
|
122
|
-
))
|
123
|
-
task = self.klass(self.ctx, self.task_config)
|
124
|
-
hosts_file_path = '/my/hosts/file'
|
125
|
-
hosts_file_obj = StringIO()
|
126
|
-
hosts_file_obj.name = hosts_file_path
|
127
|
-
with patch.object(ceph_ansible, 'NamedTemporaryFile') as m_NTF:
|
128
|
-
m_NTF.return_value = hosts_file_obj
|
129
|
-
task.generate_hosts_file()
|
130
|
-
m_NTF.assert_called_once_with(prefix="teuth_ansible_hosts_",
|
131
|
-
mode='w+',
|
132
|
-
delete=False)
|
133
|
-
assert task.generated_inventory is True
|
134
|
-
assert task.inventory == hosts_file_path
|
135
|
-
hosts_file_obj.seek(0)
|
136
|
-
assert hosts_file_obj.read() == '\n'.join([
|
137
|
-
'[mdss]',
|
138
|
-
'remote2 devices=\'[]\'',
|
139
|
-
'',
|
140
|
-
'[mons]',
|
141
|
-
'remote1 devices=\'[]\'',
|
142
|
-
'',
|
143
|
-
'[osds]',
|
144
|
-
'remote3 devices=\'["/dev/remote3"]\'',
|
145
|
-
])
|
146
|
-
|
147
|
-
def test_generate_hosts_file_with_network(self):
|
148
|
-
self.task_config.update(dict(
|
149
|
-
playbook=[],
|
150
|
-
vars=dict(
|
151
|
-
osd_auto_discovery=True,
|
152
|
-
),
|
153
|
-
))
|
154
|
-
task = self.klass(self.ctx, self.task_config)
|
155
|
-
hosts_file_path = '/my/hosts/file'
|
156
|
-
hosts_file_obj = StringIO()
|
157
|
-
hosts_file_obj.name = hosts_file_path
|
158
|
-
with patch.object(ceph_ansible, 'NamedTemporaryFile') as m_NTF:
|
159
|
-
m_NTF.return_value = hosts_file_obj
|
160
|
-
task.generate_hosts_file()
|
161
|
-
m_NTF.assert_called_once_with(prefix="teuth_ansible_hosts_",
|
162
|
-
mode='w+',
|
163
|
-
delete=False)
|
164
|
-
assert task.generated_inventory is True
|
165
|
-
assert task.inventory == hosts_file_path
|
166
|
-
hosts_file_obj.seek(0)
|
167
|
-
assert hosts_file_obj.read() == '\n'.join([
|
168
|
-
'[mdss]',
|
169
|
-
"remote2 monitor_interface='eth0' public_network='172.21.0.0/20' radosgw_interface='eth0'",
|
170
|
-
'',
|
171
|
-
'[mons]',
|
172
|
-
"remote1 monitor_interface='eth0' public_network='172.21.0.0/20' radosgw_interface='eth0'",
|
173
|
-
'',
|
174
|
-
'[osds]',
|
175
|
-
"remote3 monitor_interface='eth0' public_network='172.21.0.0/20' radosgw_interface='eth0'",
|
176
|
-
])
|
@@ -1,88 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
|
3
|
-
from mock import patch
|
4
|
-
|
5
|
-
from teuthology.config import FakeNamespace
|
6
|
-
from teuthology.config import config as teuth_config
|
7
|
-
from teuthology.orchestra.cluster import Cluster
|
8
|
-
from teuthology.orchestra.remote import Remote
|
9
|
-
from teuthology.task.console_log import ConsoleLog
|
10
|
-
|
11
|
-
from teuthology.test.task import TestTask
|
12
|
-
|
13
|
-
|
14
|
-
class TestConsoleLog(TestTask):
|
15
|
-
klass = ConsoleLog
|
16
|
-
task_name = 'console_log'
|
17
|
-
|
18
|
-
def setup(self):
|
19
|
-
teuth_config.ipmi_domain = 'ipmi.domain'
|
20
|
-
teuth_config.ipmi_user = 'ipmi_user'
|
21
|
-
teuth_config.ipmi_password = 'ipmi_pass'
|
22
|
-
self.ctx = FakeNamespace()
|
23
|
-
self.ctx.cluster = Cluster()
|
24
|
-
self.ctx.cluster.add(Remote('user@remote1'), ['role1'])
|
25
|
-
self.ctx.cluster.add(Remote('user@remote2'), ['role2'])
|
26
|
-
self.ctx.config = dict()
|
27
|
-
self.ctx.archive = '/fake/path'
|
28
|
-
self.task_config = dict()
|
29
|
-
self.start_patchers()
|
30
|
-
|
31
|
-
def start_patchers(self):
|
32
|
-
self.patchers = dict()
|
33
|
-
self.patchers['makedirs'] = patch(
|
34
|
-
'teuthology.task.console_log.os.makedirs',
|
35
|
-
)
|
36
|
-
self.patchers['is_vm'] = patch(
|
37
|
-
'teuthology.lock.query.is_vm',
|
38
|
-
)
|
39
|
-
self.patchers['is_vm'].return_value = False
|
40
|
-
self.patchers['get_status'] = patch(
|
41
|
-
'teuthology.lock.query.get_status',
|
42
|
-
)
|
43
|
-
self.mocks = dict()
|
44
|
-
for name, patcher in self.patchers.items():
|
45
|
-
self.mocks[name] = patcher.start()
|
46
|
-
self.mocks['is_vm'].return_value = False
|
47
|
-
|
48
|
-
def teardown(self):
|
49
|
-
for patcher in self.patchers.values():
|
50
|
-
patcher.stop()
|
51
|
-
|
52
|
-
def test_enabled(self):
|
53
|
-
task = self.klass(self.ctx, self.task_config)
|
54
|
-
assert task.enabled is True
|
55
|
-
|
56
|
-
def test_disabled_noarchive(self):
|
57
|
-
self.ctx.archive = None
|
58
|
-
task = self.klass(self.ctx, self.task_config)
|
59
|
-
assert task.enabled is False
|
60
|
-
|
61
|
-
def test_has_ipmi_credentials(self):
|
62
|
-
for remote in self.ctx.cluster.remotes.keys():
|
63
|
-
remote.console.has_ipmi_credentials = False
|
64
|
-
remote.console.has_conserver = False
|
65
|
-
task = self.klass(self.ctx, self.task_config)
|
66
|
-
assert len(task.cluster.remotes.keys()) == 0
|
67
|
-
|
68
|
-
def test_remotes(self):
|
69
|
-
with self.klass(self.ctx, self.task_config) as task:
|
70
|
-
assert len(task.cluster.remotes) == len(self.ctx.cluster.remotes)
|
71
|
-
|
72
|
-
@patch('teuthology.orchestra.console.PhysicalConsole')
|
73
|
-
def test_begin(self, m_pconsole):
|
74
|
-
with self.klass(self.ctx, self.task_config) as task:
|
75
|
-
assert len(task.processes) == len(self.ctx.cluster.remotes)
|
76
|
-
for remote in task.cluster.remotes.keys():
|
77
|
-
dest_path = os.path.join(
|
78
|
-
self.ctx.archive, '%s.log' % remote.shortname)
|
79
|
-
assert remote.console.spawn_sol_log.called_once_with(
|
80
|
-
dest_path=dest_path)
|
81
|
-
|
82
|
-
@patch('teuthology.orchestra.console.PhysicalConsole')
|
83
|
-
def test_end(self, m_pconsole):
|
84
|
-
with self.klass(self.ctx, self.task_config) as task:
|
85
|
-
pass
|
86
|
-
for proc in task.processes.values():
|
87
|
-
assert proc.terminate.called_once_with()
|
88
|
-
assert proc.kill.called_once_with()
|
@@ -1,337 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import pytest
|
3
|
-
import yaml
|
4
|
-
|
5
|
-
from mock import patch, Mock
|
6
|
-
|
7
|
-
from teuthology.task import install
|
8
|
-
|
9
|
-
|
10
|
-
class TestInstall(object):
|
11
|
-
|
12
|
-
def _get_default_package_list(self, project='ceph', debug=False):
|
13
|
-
path = os.path.join(
|
14
|
-
os.path.dirname(__file__),
|
15
|
-
'..', '..', 'task', 'install', 'packages.yaml',
|
16
|
-
)
|
17
|
-
pkgs = yaml.safe_load(open(path))[project]
|
18
|
-
if not debug:
|
19
|
-
pkgs['deb'] = [p for p in pkgs['deb']
|
20
|
-
if not p.endswith('-dbg')]
|
21
|
-
pkgs['rpm'] = [p for p in pkgs['rpm']
|
22
|
-
if not p.endswith('-debuginfo')]
|
23
|
-
return pkgs
|
24
|
-
|
25
|
-
def test_get_package_list_debug(self):
|
26
|
-
default_pkgs = self._get_default_package_list(debug=True)
|
27
|
-
default_pkgs['rpm'].sort()
|
28
|
-
default_pkgs['deb'].sort()
|
29
|
-
config = dict(debuginfo=True)
|
30
|
-
result = install.get_package_list(ctx=None, config=config)
|
31
|
-
result['rpm'].sort()
|
32
|
-
result['deb'].sort()
|
33
|
-
assert result == default_pkgs
|
34
|
-
|
35
|
-
def test_get_package_list_no_debug(self):
|
36
|
-
default_pkgs = self._get_default_package_list(debug=False)
|
37
|
-
default_pkgs['rpm'].sort()
|
38
|
-
default_pkgs['deb'].sort()
|
39
|
-
config = dict(debuginfo=False)
|
40
|
-
result = install.get_package_list(ctx=None, config=config)
|
41
|
-
result['rpm'].sort()
|
42
|
-
result['deb'].sort()
|
43
|
-
assert result == default_pkgs
|
44
|
-
|
45
|
-
def test_get_package_list_custom_rpm(self):
|
46
|
-
default_pkgs = self._get_default_package_list(debug=False)
|
47
|
-
default_pkgs['rpm'].sort()
|
48
|
-
default_pkgs['deb'].sort()
|
49
|
-
rpms = ['rpm1', 'rpm2', 'rpm2-debuginfo']
|
50
|
-
config = dict(packages=dict(rpm=rpms))
|
51
|
-
result = install.get_package_list(ctx=None, config=config)
|
52
|
-
result['rpm'].sort()
|
53
|
-
result['deb'].sort()
|
54
|
-
assert result['rpm'] == ['rpm1', 'rpm2']
|
55
|
-
assert result['deb'] == default_pkgs['deb']
|
56
|
-
|
57
|
-
@patch("teuthology.task.install._get_builder_project")
|
58
|
-
@patch("teuthology.task.install.packaging.get_package_version")
|
59
|
-
def test_get_upgrade_version(self, m_get_package_version,
|
60
|
-
m_gitbuilder_project):
|
61
|
-
gb = Mock()
|
62
|
-
gb.version = "11.0.0"
|
63
|
-
gb.project = "ceph"
|
64
|
-
m_gitbuilder_project.return_value = gb
|
65
|
-
m_get_package_version.return_value = "11.0.0"
|
66
|
-
install.get_upgrade_version(Mock(), Mock(), Mock())
|
67
|
-
|
68
|
-
@patch("teuthology.task.install._get_builder_project")
|
69
|
-
@patch("teuthology.task.install.packaging.get_package_version")
|
70
|
-
def test_verify_ceph_version_success(self, m_get_package_version,
|
71
|
-
m_gitbuilder_project):
|
72
|
-
gb = Mock()
|
73
|
-
gb.version = "0.89.0"
|
74
|
-
gb.project = "ceph"
|
75
|
-
m_gitbuilder_project.return_value = gb
|
76
|
-
m_get_package_version.return_value = "0.89.0"
|
77
|
-
config = dict()
|
78
|
-
install.verify_package_version(Mock(), config, Mock())
|
79
|
-
|
80
|
-
@patch("teuthology.task.install._get_builder_project")
|
81
|
-
@patch("teuthology.task.install.packaging.get_package_version")
|
82
|
-
def test_verify_ceph_version_failed(self, m_get_package_version,
|
83
|
-
m_gitbuilder_project):
|
84
|
-
gb = Mock()
|
85
|
-
gb.version = "0.89.0"
|
86
|
-
gb.project = "ceph"
|
87
|
-
m_gitbuilder_project.return_value = gb
|
88
|
-
m_get_package_version.return_value = "0.89.1"
|
89
|
-
config = dict()
|
90
|
-
with pytest.raises(RuntimeError):
|
91
|
-
install.verify_package_version(Mock(), config, Mock())
|
92
|
-
|
93
|
-
@patch("teuthology.task.install._get_builder_project")
|
94
|
-
@patch("teuthology.task.install.packaging.get_package_version")
|
95
|
-
def test_skip_when_using_ceph_deploy(self, m_get_package_version,
|
96
|
-
m_gitbuilder_project):
|
97
|
-
gb = Mock()
|
98
|
-
gb.version = "0.89.0"
|
99
|
-
gb.project = "ceph"
|
100
|
-
m_gitbuilder_project.return_value = gb
|
101
|
-
# ceph isn't installed because ceph-deploy would install it
|
102
|
-
m_get_package_version.return_value = None
|
103
|
-
config = dict()
|
104
|
-
config['extras'] = True
|
105
|
-
install.verify_package_version(Mock(), config, Mock())
|
106
|
-
|
107
|
-
def test_get_flavor_default(self):
|
108
|
-
config = dict()
|
109
|
-
assert install.get_flavor(config) == 'basic'
|
110
|
-
|
111
|
-
def test_get_flavor_simple(self):
|
112
|
-
config = dict(
|
113
|
-
flavor='notcmalloc'
|
114
|
-
)
|
115
|
-
assert install.get_flavor(config) == 'notcmalloc'
|
116
|
-
|
117
|
-
def test_get_flavor_valgrind(self):
|
118
|
-
config = dict(
|
119
|
-
valgrind=True
|
120
|
-
)
|
121
|
-
assert install.get_flavor(config) == 'notcmalloc'
|
122
|
-
|
123
|
-
def test_upgrade_is_downgrade(self):
|
124
|
-
assert_ok_vals = [
|
125
|
-
('9.0.0', '10.0.0'),
|
126
|
-
('10.2.2-63-g8542898-1trusty', '10.2.2-64-gabcdef1-1trusty'),
|
127
|
-
('11.0.0-918.g13c13c7', '11.0.0-2165.gabcdef1')
|
128
|
-
]
|
129
|
-
for t in assert_ok_vals:
|
130
|
-
assert install._upgrade_is_downgrade(t[0], t[1]) == False
|
131
|
-
|
132
|
-
@patch("teuthology.packaging.get_package_version")
|
133
|
-
@patch("teuthology.misc.get_system_type")
|
134
|
-
@patch("teuthology.task.install.verify_package_version")
|
135
|
-
@patch("teuthology.task.install.get_upgrade_version")
|
136
|
-
def test_upgrade_common(self,
|
137
|
-
m_get_upgrade_version,
|
138
|
-
m_verify_package_version,
|
139
|
-
m_get_system_type,
|
140
|
-
m_get_package_version):
|
141
|
-
expected_system_type = 'deb'
|
142
|
-
def make_remote():
|
143
|
-
remote = Mock()
|
144
|
-
remote.arch = 'x86_64'
|
145
|
-
remote.os = Mock()
|
146
|
-
remote.os.name = 'ubuntu'
|
147
|
-
remote.os.version = '14.04'
|
148
|
-
remote.os.codename = 'trusty'
|
149
|
-
remote.system_type = expected_system_type
|
150
|
-
return remote
|
151
|
-
ctx = Mock()
|
152
|
-
class cluster:
|
153
|
-
remote1 = make_remote()
|
154
|
-
remote2 = make_remote()
|
155
|
-
remotes = {
|
156
|
-
remote1: ['client.0'],
|
157
|
-
remote2: ['mon.a','osd.0'],
|
158
|
-
}
|
159
|
-
def only(self, role):
|
160
|
-
result = Mock()
|
161
|
-
if role in ('client.0',):
|
162
|
-
result.remotes = { cluster.remote1: None }
|
163
|
-
if role in ('osd.0', 'mon.a'):
|
164
|
-
result.remotes = { cluster.remote2: None }
|
165
|
-
return result
|
166
|
-
ctx.cluster = cluster()
|
167
|
-
config = {
|
168
|
-
'client.0': {
|
169
|
-
'sha1': 'expectedsha1',
|
170
|
-
},
|
171
|
-
}
|
172
|
-
ctx.config = {
|
173
|
-
'roles': [ ['client.0'], ['mon.a','osd.0'] ],
|
174
|
-
'tasks': [
|
175
|
-
{
|
176
|
-
'install.upgrade': config,
|
177
|
-
},
|
178
|
-
],
|
179
|
-
}
|
180
|
-
m_get_upgrade_version.return_value = "11.0.0"
|
181
|
-
m_get_package_version.return_value = "10.2.4"
|
182
|
-
m_get_system_type.return_value = "deb"
|
183
|
-
def upgrade(ctx, node, remote, pkgs, system_type):
|
184
|
-
assert system_type == expected_system_type
|
185
|
-
assert install.upgrade_common(ctx, config, upgrade) == 1
|
186
|
-
expected_config = {
|
187
|
-
'project': 'ceph',
|
188
|
-
'sha1': 'expectedsha1',
|
189
|
-
}
|
190
|
-
m_verify_package_version.assert_called_with(ctx,
|
191
|
-
expected_config,
|
192
|
-
cluster.remote1)
|
193
|
-
def test_upgrade_remote_to_config(self):
|
194
|
-
expected_system_type = 'deb'
|
195
|
-
def make_remote():
|
196
|
-
remote = Mock()
|
197
|
-
remote.arch = 'x86_64'
|
198
|
-
remote.os = Mock()
|
199
|
-
remote.os.name = 'ubuntu'
|
200
|
-
remote.os.version = '14.04'
|
201
|
-
remote.os.codename = 'trusty'
|
202
|
-
remote.system_type = expected_system_type
|
203
|
-
return remote
|
204
|
-
ctx = Mock()
|
205
|
-
class cluster:
|
206
|
-
remote1 = make_remote()
|
207
|
-
remote2 = make_remote()
|
208
|
-
remotes = {
|
209
|
-
remote1: ['client.0'],
|
210
|
-
remote2: ['mon.a','osd.0'],
|
211
|
-
}
|
212
|
-
def only(self, role):
|
213
|
-
result = Mock()
|
214
|
-
if role in ('client.0',):
|
215
|
-
result.remotes = { cluster.remote1: None }
|
216
|
-
elif role in ('osd.0', 'mon.a'):
|
217
|
-
result.remotes = { cluster.remote2: None }
|
218
|
-
else:
|
219
|
-
result.remotes = None
|
220
|
-
return result
|
221
|
-
ctx.cluster = cluster()
|
222
|
-
ctx.config = {
|
223
|
-
'roles': [ ['client.0'], ['mon.a','osd.0'] ],
|
224
|
-
}
|
225
|
-
|
226
|
-
# nothing -> nothing
|
227
|
-
assert install.upgrade_remote_to_config(ctx, {}) == {}
|
228
|
-
|
229
|
-
# select the remote for the osd.0 role
|
230
|
-
# the 'ignored' role does not exist and is ignored
|
231
|
-
# the remote for mon.a is the same as for osd.0 and
|
232
|
-
# is silently ignored (actually it could be the other
|
233
|
-
# way around, depending on how the keys are hashed)
|
234
|
-
config = {
|
235
|
-
'osd.0': {
|
236
|
-
'sha1': 'expectedsha1',
|
237
|
-
},
|
238
|
-
'ignored': None,
|
239
|
-
'mon.a': {
|
240
|
-
'sha1': 'expectedsha1',
|
241
|
-
},
|
242
|
-
}
|
243
|
-
expected_config = {
|
244
|
-
cluster.remote2: {
|
245
|
-
'project': 'ceph',
|
246
|
-
'sha1': 'expectedsha1',
|
247
|
-
},
|
248
|
-
}
|
249
|
-
assert install.upgrade_remote_to_config(ctx, config) == expected_config
|
250
|
-
|
251
|
-
# select all nodes, regardless
|
252
|
-
config = {
|
253
|
-
'all': {
|
254
|
-
'sha1': 'expectedsha1',
|
255
|
-
},
|
256
|
-
}
|
257
|
-
expected_config = {
|
258
|
-
cluster.remote1: {
|
259
|
-
'project': 'ceph',
|
260
|
-
'sha1': 'expectedsha1',
|
261
|
-
},
|
262
|
-
cluster.remote2: {
|
263
|
-
'project': 'ceph',
|
264
|
-
'sha1': 'expectedsha1',
|
265
|
-
},
|
266
|
-
}
|
267
|
-
assert install.upgrade_remote_to_config(ctx, config) == expected_config
|
268
|
-
|
269
|
-
# verify that install overrides are used as default
|
270
|
-
# values for the upgrade task, not as override
|
271
|
-
ctx.config['overrides'] = {
|
272
|
-
'install': {
|
273
|
-
'ceph': {
|
274
|
-
'sha1': 'overridesha1',
|
275
|
-
'tag': 'overridetag',
|
276
|
-
'branch': 'overridebranch',
|
277
|
-
},
|
278
|
-
},
|
279
|
-
}
|
280
|
-
config = {
|
281
|
-
'client.0': {
|
282
|
-
'sha1': 'expectedsha1',
|
283
|
-
},
|
284
|
-
'osd.0': {
|
285
|
-
},
|
286
|
-
}
|
287
|
-
expected_config = {
|
288
|
-
cluster.remote1: {
|
289
|
-
'project': 'ceph',
|
290
|
-
'sha1': 'expectedsha1',
|
291
|
-
},
|
292
|
-
cluster.remote2: {
|
293
|
-
'project': 'ceph',
|
294
|
-
'sha1': 'overridesha1',
|
295
|
-
'tag': 'overridetag',
|
296
|
-
'branch': 'overridebranch',
|
297
|
-
},
|
298
|
-
}
|
299
|
-
assert install.upgrade_remote_to_config(ctx, config) == expected_config
|
300
|
-
|
301
|
-
|
302
|
-
@patch("teuthology.task.install.packaging.get_package_version")
|
303
|
-
@patch("teuthology.task.install.redhat.set_deb_repo")
|
304
|
-
def test_rh_install_deb_pkgs(self, m_set_rh_deb_repo, m_get_pkg_version):
|
305
|
-
ctx = Mock()
|
306
|
-
remote = Mock()
|
307
|
-
version = '1.3.2'
|
308
|
-
rh_ds_yaml = dict()
|
309
|
-
rh_ds_yaml = {
|
310
|
-
'versions': {'deb': {'mapped': {'1.3.2': '0.94.5'}}},
|
311
|
-
'pkgs': {'deb': ['pkg1', 'pkg2']},
|
312
|
-
'extra_system_packages': {'deb': ['es_pkg1', 'es_pkg2']},
|
313
|
-
'extra_packages': {'deb': ['e_pkg1', 'e_pkg2']},
|
314
|
-
}
|
315
|
-
m_get_pkg_version.return_value = "0.94.5"
|
316
|
-
install.redhat.install_deb_pkgs(ctx, remote, version, rh_ds_yaml)
|
317
|
-
|
318
|
-
@patch("teuthology.task.install.packaging.get_package_version")
|
319
|
-
def test_rh_install_pkgs(self, m_get_pkg_version):
|
320
|
-
ctx = Mock()
|
321
|
-
remote = Mock()
|
322
|
-
version = '1.3.2'
|
323
|
-
rh_ds_yaml = dict()
|
324
|
-
rh_ds_yaml = {
|
325
|
-
'versions': {'rpm': {'mapped': {'1.3.2': '0.94.5',
|
326
|
-
'1.3.1': '0.94.3'}}},
|
327
|
-
'pkgs': {'rpm': ['pkg1', 'pkg2']},
|
328
|
-
'extra_system_packages': {'rpm': ['es_pkg1', 'es_pkg2']},
|
329
|
-
'extra_packages': {'rpm': ['e_pkg1', 'e_pkg2']},
|
330
|
-
}
|
331
|
-
|
332
|
-
m_get_pkg_version.return_value = "0.94.5"
|
333
|
-
install.redhat.install_pkgs(ctx, remote, version, rh_ds_yaml)
|
334
|
-
version = '1.3.1'
|
335
|
-
with pytest.raises(RuntimeError) as e:
|
336
|
-
install.redhat.install_pkgs(ctx, remote, version, rh_ds_yaml)
|
337
|
-
assert "Version check failed" in str(e)
|
@@ -1,57 +0,0 @@
|
|
1
|
-
from teuthology.config import FakeNamespace
|
2
|
-
from teuthology.task import internal
|
3
|
-
|
4
|
-
|
5
|
-
class TestInternal(object):
|
6
|
-
def setup(self):
|
7
|
-
self.ctx = FakeNamespace()
|
8
|
-
self.ctx.config = dict()
|
9
|
-
|
10
|
-
def test_buildpackages_prep(self):
|
11
|
-
#
|
12
|
-
# no buildpackages nor install tasks
|
13
|
-
#
|
14
|
-
self.ctx.config = { 'tasks': [] }
|
15
|
-
assert internal.buildpackages_prep(self.ctx,
|
16
|
-
self.ctx.config) == internal.BUILDPACKAGES_NOTHING
|
17
|
-
#
|
18
|
-
# make the buildpackages tasks the first to run
|
19
|
-
#
|
20
|
-
self.ctx.config = {
|
21
|
-
'tasks': [ { 'atask': None },
|
22
|
-
{ 'internal.buildpackages_prep': None },
|
23
|
-
{ 'btask': None },
|
24
|
-
{ 'install': None },
|
25
|
-
{ 'buildpackages': None } ],
|
26
|
-
}
|
27
|
-
assert internal.buildpackages_prep(self.ctx,
|
28
|
-
self.ctx.config) == internal.BUILDPACKAGES_FIRST
|
29
|
-
assert self.ctx.config == {
|
30
|
-
'tasks': [ { 'atask': None },
|
31
|
-
{ 'internal.buildpackages_prep': None },
|
32
|
-
{ 'buildpackages': None },
|
33
|
-
{ 'btask': None },
|
34
|
-
{ 'install': None } ],
|
35
|
-
}
|
36
|
-
#
|
37
|
-
# the buildpackages task already the first task to run
|
38
|
-
#
|
39
|
-
assert internal.buildpackages_prep(self.ctx,
|
40
|
-
self.ctx.config) == internal.BUILDPACKAGES_OK
|
41
|
-
#
|
42
|
-
# no buildpackages task
|
43
|
-
#
|
44
|
-
self.ctx.config = {
|
45
|
-
'tasks': [ { 'install': None } ],
|
46
|
-
}
|
47
|
-
assert internal.buildpackages_prep(self.ctx,
|
48
|
-
self.ctx.config) == internal.BUILDPACKAGES_NOTHING
|
49
|
-
#
|
50
|
-
# no install task: the buildpackages task must be removed
|
51
|
-
#
|
52
|
-
self.ctx.config = {
|
53
|
-
'tasks': [ { 'buildpackages': None } ],
|
54
|
-
}
|
55
|
-
assert internal.buildpackages_prep(self.ctx,
|
56
|
-
self.ctx.config) == internal.BUILDPACKAGES_REMOVED
|
57
|
-
assert self.ctx.config == {'tasks': []}
|