teuthology 1.2.0__py3-none-any.whl → 1.2.1__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.
- teuthology/orchestra/connection.py +3 -1
- teuthology/orchestra/daemon/cephadmunit.py +2 -2
- {teuthology-1.2.0.dist-info → teuthology-1.2.1.dist-info}/METADATA +2 -3
- {teuthology-1.2.0.dist-info → teuthology-1.2.1.dist-info}/RECORD +11 -17
- {teuthology-1.2.0.dist-info → teuthology-1.2.1.dist-info}/WHEEL +1 -1
- teuthology/lock/test/__init__.py +0 -0
- teuthology/lock/test/test_lock.py +0 -7
- teuthology/task/tests/__init__.py +0 -170
- teuthology/task/tests/test_fetch_coredumps.py +0 -116
- teuthology/task/tests/test_locking.py +0 -25
- teuthology/task/tests/test_run.py +0 -40
- {teuthology-1.2.0.data → teuthology-1.2.1.data}/scripts/adjust-ulimits +0 -0
- {teuthology-1.2.0.data → teuthology-1.2.1.data}/scripts/daemon-helper +0 -0
- {teuthology-1.2.0.data → teuthology-1.2.1.data}/scripts/stdin-killer +0 -0
- {teuthology-1.2.0.dist-info → teuthology-1.2.1.dist-info}/LICENSE +0 -0
- {teuthology-1.2.0.dist-info → teuthology-1.2.1.dist-info}/entry_points.txt +0 -0
- {teuthology-1.2.0.dist-info → teuthology-1.2.1.dist-info}/top_level.txt +0 -0
@@ -82,7 +82,7 @@ def connect(user_at_host, host_key=None, keep_alive=False, timeout=60,
|
|
82
82
|
key_filename = key_filename or config.ssh_key
|
83
83
|
ssh_config_path = config.ssh_config_path or "~/.ssh/config"
|
84
84
|
ssh_config_path = os.path.expanduser(ssh_config_path)
|
85
|
-
if
|
85
|
+
if os.path.exists(ssh_config_path):
|
86
86
|
ssh_config = paramiko.SSHConfig()
|
87
87
|
ssh_config.parse(open(ssh_config_path))
|
88
88
|
opts = ssh_config.lookup(host)
|
@@ -90,6 +90,8 @@ def connect(user_at_host, host_key=None, keep_alive=False, timeout=60,
|
|
90
90
|
key_filename = opts['identityfile']
|
91
91
|
if 'hostname' in opts:
|
92
92
|
connect_args['hostname'] = opts['hostname']
|
93
|
+
if 'user' in opts:
|
94
|
+
connect_args['username'] = opts['user']
|
93
95
|
|
94
96
|
if key_filename:
|
95
97
|
if not isinstance(key_filename, list):
|
@@ -35,9 +35,9 @@ class CephadmUnit(DaemonState):
|
|
35
35
|
|
36
36
|
def kill_cmd(self, sig):
|
37
37
|
return ' '.join([
|
38
|
-
'sudo', '
|
38
|
+
'sudo', 'docker', 'kill',
|
39
39
|
'-s', str(int(sig)),
|
40
|
-
'ceph-%s
|
40
|
+
'ceph-%s-%s.%s' % (self.fsid, self.type_, self.id_),
|
41
41
|
])
|
42
42
|
|
43
43
|
def _start_logger(self):
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: teuthology
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.1
|
4
4
|
Summary: Ceph test framework
|
5
5
|
Home-page: https://github.com/ceph/teuthology
|
6
|
-
Author:
|
6
|
+
Author: Red Hat, Inc.
|
7
7
|
License: MIT
|
8
8
|
Keywords: teuthology,test,ceph,cluster
|
9
9
|
Classifier: Intended Audience :: Developers
|
@@ -30,7 +30,6 @@ Requires-Dist: backports.ssl-match-hostname
|
|
30
30
|
Requires-Dist: beanstalkc3>=0.4.0
|
31
31
|
Requires-Dist: configobj
|
32
32
|
Requires-Dist: configparser
|
33
|
-
Requires-Dist: cryptography==41.0.7
|
34
33
|
Requires-Dist: docopt
|
35
34
|
Requires-Dist: gevent
|
36
35
|
Requires-Dist: httplib2
|
@@ -51,8 +51,6 @@ teuthology/lock/cli.py,sha256=byhxaW-ZjxKXzy9oyULGj81PfpmCC3J2ADCT1xRrHJc,11933
|
|
51
51
|
teuthology/lock/ops.py,sha256=rJlT6N6FGmq1LBxpBEmUL4J7z5ngww6367bnXif-wcQ,19830
|
52
52
|
teuthology/lock/query.py,sha256=JOrd7JWTV3dMuwwv03kHHnpl6XdMUkES2XpDhBDctME,5444
|
53
53
|
teuthology/lock/util.py,sha256=nI7AAazV7aspr_s_jblVhDt6BuJxbBawN1IY755ngpA,3719
|
54
|
-
teuthology/lock/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
|
-
teuthology/lock/test/test_lock.py,sha256=Sxppi_4puEzXln6UtKY69ZC8ReXGRFV7ObPTOqRG-lI,229
|
56
54
|
teuthology/nuke/__init__.py,sha256=qlnMNKy3ULSuJhq9NO9PaUrFn7Gv35HmZlMWOCHfykk,619
|
57
55
|
teuthology/openstack/__init__.py,sha256=WYvHVgzuZGpOPbMNVhf1yHZGWUBN8rzmFsMN2WH9bgA,54841
|
58
56
|
teuthology/openstack/archive-key,sha256=x_4TjSfktzupIuRYnJA8vwFj6jspXGNVR_8YvajZBtU,1675
|
@@ -71,14 +69,14 @@ teuthology/openstack/openstack-user-data.txt,sha256=lyzGBNI0hPury7DSsgqEyUfkc0GV
|
|
71
69
|
teuthology/openstack/setup-openstack.sh,sha256=OYzY9Koy0iHun5aUMwL8VM_rpXxiMpD_BvNNS0hPR-Y,24471
|
72
70
|
teuthology/orchestra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
73
71
|
teuthology/orchestra/cluster.py,sha256=o46Q1L05YKWNB5szNMfZU8l0X8ndqXWU7tDrBlIgjB0,6697
|
74
|
-
teuthology/orchestra/connection.py,sha256=
|
72
|
+
teuthology/orchestra/connection.py,sha256=OFb8ahpg0e04ICijevnhut_ckN0Ls7oQxhVXQt-p90Q,4078
|
75
73
|
teuthology/orchestra/console.py,sha256=DVW2T3F0_Kcm1KyjIu05ngj8c3v5WxScJeH3fZtr81k,15718
|
76
74
|
teuthology/orchestra/monkey.py,sha256=YtwEnrQyEOEJG2_oozzDmnfsB33jeAmtzvsxEbnLkfA,1385
|
77
75
|
teuthology/orchestra/opsys.py,sha256=TXScUAkQQdcmf4GPI_seubsiCvHi4P_SK1FXGzCP7Us,7102
|
78
76
|
teuthology/orchestra/remote.py,sha256=C7wNVW9PtugUOy3Y-8I_llhRIdZnN_Msy9CgjU4-bak,25656
|
79
77
|
teuthology/orchestra/run.py,sha256=TVyeWBPMJw3egUIVQILEgI0JunvjI0z5KN-hN_k4R4U,16180
|
80
78
|
teuthology/orchestra/daemon/__init__.py,sha256=gB0iOtyIROajsYE-UTT-unCnLxkeyYJxLQ7u2bqoaxk,66
|
81
|
-
teuthology/orchestra/daemon/cephadmunit.py,sha256=
|
79
|
+
teuthology/orchestra/daemon/cephadmunit.py,sha256=C_k3T__3CXK4zCctega5C16_oyzXWJIyPIYlOHTR6s8,6133
|
82
80
|
teuthology/orchestra/daemon/group.py,sha256=ydMrCtJYFc2rIa1YUVdFS2UZ3exBkTvpPq8LCojxA7M,7625
|
83
81
|
teuthology/orchestra/daemon/state.py,sha256=MdzAgBf0HubzuFP33v8UGMfhwuVYboS9W0z41bKp3sk,5598
|
84
82
|
teuthology/orchestra/daemon/systemd.py,sha256=InMxghFVqKa26DkX14Io-SW1XWTm1G8OfPEx0eUbzAU,7529
|
@@ -152,10 +150,6 @@ teuthology/task/internal/lock_machines.py,sha256=Bn3TR5ItJ-NGBw7s4-PdCJekxemS6Hp
|
|
152
150
|
teuthology/task/internal/redhat.py,sha256=I0U-OULBfPMLYtenduRts4wG3WSg3TXuUoWVm3ChrWA,9991
|
153
151
|
teuthology/task/internal/syslog.py,sha256=N9AjsLyRpQRH0D2WycuT-FstxxK4cXdet3B2PuOq814,6738
|
154
152
|
teuthology/task/internal/vm_setup.py,sha256=cNlsBmVqXTYA6BgF5Sqd3k2eh87cnfuR1KdPUsOKskw,1825
|
155
|
-
teuthology/task/tests/__init__.py,sha256=Ve_jx04qLF7gYtMnjBhV9ILdqQrh29SQvS84eXf3XxY,6099
|
156
|
-
teuthology/task/tests/test_fetch_coredumps.py,sha256=qXwk7egZ6XjEuOiqqS62y95ZwA0EjUh11FliwPQ7ovU,4863
|
157
|
-
teuthology/task/tests/test_locking.py,sha256=g2lkKkr8etr7dlCwSeIui61CAMzeGWtSgprf4ASkkk4,947
|
158
|
-
teuthology/task/tests/test_run.py,sha256=4pNUgb2qdOzJ_3u_V8tZPsvRijTuCy16RBkeZ4XO2tY,1074
|
159
153
|
teuthology/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
160
154
|
teuthology/util/compat.py,sha256=3jWbf2QSMSwq2t5ZgoGZ7z0fk98sY489P7im8j6eoOU,458
|
161
155
|
teuthology/util/flock.py,sha256=iGliYoXBzaBdMCq6dSSSQOkXC3ByrIlxvdRtJaYOG4I,604
|
@@ -163,12 +157,12 @@ teuthology/util/loggerfile.py,sha256=mg6jjC2kJzhctX7VRmYms-iaJoGXEEU-8E-ud21RKXI
|
|
163
157
|
teuthology/util/scanner.py,sha256=SLcQQuUz7sgCLMXwlW_5qQFZJWbD_IETSXqd3RYsAdg,5769
|
164
158
|
teuthology/util/sentry.py,sha256=pDe_wW5wGstu8NH3FmqaWa1GYBUA8n4o6gWNa_RHklY,1529
|
165
159
|
teuthology/util/time.py,sha256=Pn2sMtP0BQd6mUKyrOp3SGJmV8uJ5hLKaQvdf1rBXJM,1575
|
166
|
-
teuthology-1.2.
|
167
|
-
teuthology-1.2.
|
168
|
-
teuthology-1.2.
|
169
|
-
teuthology-1.2.
|
170
|
-
teuthology-1.2.
|
171
|
-
teuthology-1.2.
|
172
|
-
teuthology-1.2.
|
173
|
-
teuthology-1.2.
|
174
|
-
teuthology-1.2.
|
160
|
+
teuthology-1.2.1.data/scripts/adjust-ulimits,sha256=Bgdmytehcl6Y3e2Lmg2Gstx5r_Xkl9DvWO7g74DLzfs,299
|
161
|
+
teuthology-1.2.1.data/scripts/daemon-helper,sha256=R8GE83f41E_p5SO6egeyIhABmXz1qwuCwfrc89Uo3ug,3048
|
162
|
+
teuthology-1.2.1.data/scripts/stdin-killer,sha256=GuhUjSBxU81FL8F7mUOpdIl1yH4gFpEd_Dt3KJu60DU,8627
|
163
|
+
teuthology-1.2.1.dist-info/LICENSE,sha256=ghAkcYBW8nQm9oZJTob8w6h4Ga8ovjAv3boORc0qbYs,1057
|
164
|
+
teuthology-1.2.1.dist-info/METADATA,sha256=oYM3_kXcYQOUMoDsu7zTbMV90TnzaavcWAk2lmXxPKI,3188
|
165
|
+
teuthology-1.2.1.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
166
|
+
teuthology-1.2.1.dist-info/entry_points.txt,sha256=7TnOX2EuE5RkoVzz_rXt-12Dn5ZTk3Ie2RDu8Dw591c,910
|
167
|
+
teuthology-1.2.1.dist-info/top_level.txt,sha256=h2iGdGnj97Y9V5XwADbLYyhjY4Fek6KMSxrvYVNnphQ,19
|
168
|
+
teuthology-1.2.1.dist-info/RECORD,,
|
teuthology/lock/test/__init__.py
DELETED
File without changes
|
@@ -1,170 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
This task runs teuthology's unit tests and integration tests.
|
3
|
-
It can run in one of two modes: "py" or "cli". The latter executes py.test in a
|
4
|
-
separate process, whereas the former invokes it in the teuthology job's python
|
5
|
-
process.
|
6
|
-
If the running job has remotes available to it, it will attempt to run integration tests.
|
7
|
-
Note that this requires running in "py" mode - the default.
|
8
|
-
|
9
|
-
An example::
|
10
|
-
|
11
|
-
tasks
|
12
|
-
- tests:
|
13
|
-
"""
|
14
|
-
import logging
|
15
|
-
import os
|
16
|
-
import pathlib
|
17
|
-
import pexpect
|
18
|
-
import pytest
|
19
|
-
|
20
|
-
from teuthology.job_status import set_status
|
21
|
-
from teuthology.task import Task
|
22
|
-
from teuthology.util.loggerfile import LoggerFile
|
23
|
-
|
24
|
-
|
25
|
-
log = logging.getLogger(__name__)
|
26
|
-
|
27
|
-
|
28
|
-
class TeuthologyContextPlugin(object):
|
29
|
-
def __init__(self, ctx, config):
|
30
|
-
self.ctx = ctx
|
31
|
-
self.config = config
|
32
|
-
self.failures = list()
|
33
|
-
self.stats = dict()
|
34
|
-
|
35
|
-
# this is pytest hook for generating tests with custom parameters
|
36
|
-
def pytest_generate_tests(self, metafunc):
|
37
|
-
# pass the teuthology ctx and config to each test method
|
38
|
-
if "ctx" in metafunc.fixturenames and \
|
39
|
-
"config" in metafunc.fixturenames:
|
40
|
-
metafunc.parametrize(["ctx", "config"], [(self.ctx, self.config),])
|
41
|
-
|
42
|
-
# log the outcome of each test
|
43
|
-
@pytest.hookimpl(hookwrapper=True)
|
44
|
-
def pytest_runtest_makereport(self, item: pytest.Item, call: pytest.CallInfo):
|
45
|
-
outcome = yield
|
46
|
-
report = outcome.get_result()
|
47
|
-
test_path = item.location[0]
|
48
|
-
line_no = item.location[1]
|
49
|
-
test_name = item.location[2]
|
50
|
-
name = f"{test_path}:{line_no}:{test_name}"
|
51
|
-
log_msg = f"{report.outcome.upper()} {name}"
|
52
|
-
outcome_str = report.outcome.lower()
|
53
|
-
self.stats.setdefault(outcome_str, 0)
|
54
|
-
self.stats[outcome_str] += 1
|
55
|
-
if outcome_str in ['passed', 'skipped']:
|
56
|
-
if call.when == 'call':
|
57
|
-
log.info(log_msg)
|
58
|
-
else:
|
59
|
-
log.info(f"----- {name} {call.when} -----")
|
60
|
-
else:
|
61
|
-
log_msg = f"{log_msg}:{call.when}"
|
62
|
-
if call.excinfo:
|
63
|
-
self.failures.append(name)
|
64
|
-
log_msg = f"{log_msg}: {call.excinfo.getrepr()}"
|
65
|
-
else:
|
66
|
-
self.failures.append(log_msg)
|
67
|
-
log.error(log_msg)
|
68
|
-
|
69
|
-
return
|
70
|
-
|
71
|
-
|
72
|
-
# https://docs.pytest.org/en/stable/reference/exit-codes.html
|
73
|
-
exit_codes = {
|
74
|
-
0: "All tests were collected and passed successfully",
|
75
|
-
1: "Tests were collected and run but some of the tests failed",
|
76
|
-
2: "Test execution was interrupted by the user",
|
77
|
-
3: "Internal error happened while executing tests",
|
78
|
-
4: "pytest command line usage error",
|
79
|
-
5: "No tests were collected",
|
80
|
-
}
|
81
|
-
|
82
|
-
|
83
|
-
class Tests(Task):
|
84
|
-
"""
|
85
|
-
Use pytest to recurse through this directory, finding any tests
|
86
|
-
and then executing them with the teuthology ctx and config args.
|
87
|
-
Your tests must follow standard pytest conventions to be discovered.
|
88
|
-
|
89
|
-
If config["mode"] == "py", (the default), it will be run in the job's process.
|
90
|
-
If config["mode"] == "cli" py.test will be invoked as a subprocess.
|
91
|
-
"""
|
92
|
-
base_args = ['-v', '--color=no']
|
93
|
-
|
94
|
-
def setup(self):
|
95
|
-
super().setup()
|
96
|
-
mode = self.config.get("mode", "py")
|
97
|
-
assert mode in ["py", "cli"], "mode must either be 'py' or 'cli'"
|
98
|
-
if mode == "cli":
|
99
|
-
# integration tests need ctx from this process, so we need to invoke
|
100
|
-
# pytest via python to be able to pass them
|
101
|
-
assert len(self.cluster.remotes) == 0, \
|
102
|
-
"Tests requiring remote nodes conflicts with CLI mode"
|
103
|
-
self.mode = mode
|
104
|
-
self.stats = dict()
|
105
|
-
self.orig_curdir = os.curdir
|
106
|
-
|
107
|
-
def begin(self):
|
108
|
-
super().begin()
|
109
|
-
try:
|
110
|
-
if self.mode == "py":
|
111
|
-
self.status, self.failures = self.run_py()
|
112
|
-
else:
|
113
|
-
self.status, self.failures = self.run_cli()
|
114
|
-
except Exception as e:
|
115
|
-
log.exception("Saw non-test failure!")
|
116
|
-
self.ctx.summary['failure_reason'] = str(e)
|
117
|
-
set_status(self.ctx.summary, "dead")
|
118
|
-
|
119
|
-
def end(self):
|
120
|
-
if os.curdir != self.orig_curdir:
|
121
|
-
os.chdir(self.orig_curdir)
|
122
|
-
if self.stats:
|
123
|
-
log.info(f"Stats: {self.stats}")
|
124
|
-
if self.status == 0:
|
125
|
-
log.info("OK. All tests passed!")
|
126
|
-
set_status(self.ctx.summary, "pass")
|
127
|
-
else:
|
128
|
-
status_msg = str(self.status)
|
129
|
-
if self.status in exit_codes:
|
130
|
-
status_msg = f"{status_msg}: {exit_codes[self.status]}"
|
131
|
-
log.error(f"FAIL (exit code {status_msg})")
|
132
|
-
if self.failures:
|
133
|
-
msg = f"{len(self.failures)} Failures: {self.failures}"
|
134
|
-
self.ctx.summary['failure_reason'] = msg
|
135
|
-
log.error(msg)
|
136
|
-
set_status(self.ctx.summary, "fail")
|
137
|
-
super().end()
|
138
|
-
|
139
|
-
def run_cli(self):
|
140
|
-
pytest_args = self.base_args + ['./teuthology/test', './scripts']
|
141
|
-
if len(self.cluster.remotes):
|
142
|
-
pytest_args.append('./teuthology/task/tests')
|
143
|
-
self.log.info(f"pytest args: {pytest_args}")
|
144
|
-
cwd = str(pathlib.Path(__file__).parents[3])
|
145
|
-
log.info(f"pytest cwd: {cwd}")
|
146
|
-
_, status = pexpect.run(
|
147
|
-
"py.test " + " ".join(pytest_args),
|
148
|
-
cwd=cwd,
|
149
|
-
withexitstatus=True,
|
150
|
-
timeout=None,
|
151
|
-
logfile=LoggerFile(self.log, logging.INFO),
|
152
|
-
)
|
153
|
-
return status, []
|
154
|
-
|
155
|
-
def run_py(self):
|
156
|
-
pytest_args = self.base_args + ['--pyargs', 'teuthology', 'scripts']
|
157
|
-
if len(self.cluster.remotes):
|
158
|
-
pytest_args.append(__name__)
|
159
|
-
self.log.info(f"pytest args: {pytest_args}")
|
160
|
-
context_plugin = TeuthologyContextPlugin(self.ctx, self.config)
|
161
|
-
# the cwd needs to change so that FakeArchive can find files in this repo
|
162
|
-
os.chdir(str(pathlib.Path(__file__).parents[3]))
|
163
|
-
status = pytest.main(
|
164
|
-
args=pytest_args,
|
165
|
-
plugins=[context_plugin],
|
166
|
-
)
|
167
|
-
self.stats = context_plugin.stats
|
168
|
-
return status, context_plugin.failures
|
169
|
-
|
170
|
-
task = Tests
|
@@ -1,116 +0,0 @@
|
|
1
|
-
from teuthology.task.internal import fetch_binaries_for_coredumps
|
2
|
-
from unittest.mock import patch, Mock
|
3
|
-
import gzip
|
4
|
-
import os
|
5
|
-
|
6
|
-
class TestFetchCoreDumps(object):
|
7
|
-
class MockDecode(object):
|
8
|
-
def __init__(self, ret):
|
9
|
-
self.ret = ret
|
10
|
-
pass
|
11
|
-
|
12
|
-
def decode(self):
|
13
|
-
return self.ret
|
14
|
-
|
15
|
-
class MockPopen(object):
|
16
|
-
def __init__(self, ret):
|
17
|
-
self.ret = ret
|
18
|
-
|
19
|
-
def communicate(self, input=None):
|
20
|
-
return [TestFetchCoreDumps.MockDecode(self.ret)]
|
21
|
-
|
22
|
-
def setup_method(self):
|
23
|
-
self.the_function = fetch_binaries_for_coredumps
|
24
|
-
with gzip.open('file.gz', 'wb') as f:
|
25
|
-
f.write(b'Hello world!')
|
26
|
-
self.core_dump_path = "file.gz"
|
27
|
-
self.m_remote = Mock()
|
28
|
-
self.uncompressed_correct = self.MockPopen(
|
29
|
-
"ELF 64-bit LSB core file,"\
|
30
|
-
" x86-64, version 1 (SYSV), SVR4-style, from 'ceph_test_rados_api_io',"\
|
31
|
-
" real uid: 1194, effective uid: 1194, real gid: 1194,"\
|
32
|
-
" effective gid: 1194, execfn: '/usr/bin/ceph_test_rados_api_io', platform: 'x86_64'"
|
33
|
-
)
|
34
|
-
self.uncompressed_incorrect = self.MockPopen("ASCII text")
|
35
|
-
self.compressed_correct = self.MockPopen(
|
36
|
-
"gzip compressed data, was "\
|
37
|
-
"'correct.format.core', last modified: Wed Jun 29"\
|
38
|
-
" 19:55:29 2022, from Unix, original size modulo 2^32 3167080"
|
39
|
-
)
|
40
|
-
|
41
|
-
self.compressed_incorrect = self.MockPopen(
|
42
|
-
"gzip compressed data, was "\
|
43
|
-
"'incorrect.format.core', last modified: Wed Jun 29"\
|
44
|
-
" 19:56:56 2022, from Unix, original size modulo 2^32 11"
|
45
|
-
)
|
46
|
-
|
47
|
-
# Core is not compressed and file is in the correct format
|
48
|
-
@patch('teuthology.task.internal.subprocess.Popen')
|
49
|
-
@patch('teuthology.task.internal.os')
|
50
|
-
def test_uncompressed_correct_format(self, m_os, m_subproc_popen):
|
51
|
-
m_subproc_popen.side_effect = [
|
52
|
-
self.uncompressed_correct,
|
53
|
-
Exception("We shouldn't be hitting this!")
|
54
|
-
]
|
55
|
-
m_os.path.join.return_value = self.core_dump_path
|
56
|
-
m_os.path.sep = self.core_dump_path
|
57
|
-
m_os.path.isdir.return_value = True
|
58
|
-
m_os.path.dirname.return_value = self.core_dump_path
|
59
|
-
m_os.path.exists.return_value = True
|
60
|
-
m_os.listdir.return_value = [self.core_dump_path]
|
61
|
-
self.the_function(None, self.m_remote)
|
62
|
-
assert self.m_remote.get_file.called
|
63
|
-
|
64
|
-
# Core is not compressed and file is in the wrong format
|
65
|
-
@patch('teuthology.task.internal.subprocess.Popen')
|
66
|
-
@patch('teuthology.task.internal.os')
|
67
|
-
def test_uncompressed_incorrect_format(self, m_os, m_subproc_popen):
|
68
|
-
m_subproc_popen.side_effect = [
|
69
|
-
self.uncompressed_incorrect,
|
70
|
-
Exception("We shouldn't be hitting this!")
|
71
|
-
]
|
72
|
-
m_os.path.join.return_value = self.core_dump_path
|
73
|
-
m_os.path.sep = self.core_dump_path
|
74
|
-
m_os.path.isdir.return_value = True
|
75
|
-
m_os.path.dirname.return_value = self.core_dump_path
|
76
|
-
m_os.path.exists.return_value = True
|
77
|
-
m_os.listdir.return_value = [self.core_dump_path]
|
78
|
-
self.the_function(None, self.m_remote)
|
79
|
-
assert self.m_remote.get_file.called == False
|
80
|
-
|
81
|
-
# Core is compressed and file is in the correct format
|
82
|
-
@patch('teuthology.task.internal.subprocess.Popen')
|
83
|
-
@patch('teuthology.task.internal.os')
|
84
|
-
def test_compressed_correct_format(self, m_os, m_subproc_popen):
|
85
|
-
m_subproc_popen.side_effect = [
|
86
|
-
self.compressed_correct,
|
87
|
-
self.uncompressed_correct
|
88
|
-
]
|
89
|
-
m_os.path.join.return_value = self.core_dump_path
|
90
|
-
m_os.path.sep = self.core_dump_path
|
91
|
-
m_os.path.isdir.return_value = True
|
92
|
-
m_os.path.dirname.return_value = self.core_dump_path
|
93
|
-
m_os.path.exists.return_value = True
|
94
|
-
m_os.listdir.return_value = [self.core_dump_path]
|
95
|
-
self.the_function(None, self.m_remote)
|
96
|
-
assert self.m_remote.get_file.called
|
97
|
-
|
98
|
-
# Core is compressed and file is in the wrong format
|
99
|
-
@patch('teuthology.task.internal.subprocess.Popen')
|
100
|
-
@patch('teuthology.task.internal.os')
|
101
|
-
def test_compressed_incorrect_format(self, m_os, m_subproc_popen):
|
102
|
-
m_subproc_popen.side_effect = [
|
103
|
-
self.compressed_incorrect,
|
104
|
-
self.uncompressed_incorrect
|
105
|
-
]
|
106
|
-
m_os.path.join.return_value = self.core_dump_path
|
107
|
-
m_os.path.sep = self.core_dump_path
|
108
|
-
m_os.path.isdir.return_value = True
|
109
|
-
m_os.path.dirname.return_value = self.core_dump_path
|
110
|
-
m_os.path.exists.return_value = True
|
111
|
-
m_os.listdir.return_value = [self.core_dump_path]
|
112
|
-
self.the_function(None, self.m_remote)
|
113
|
-
assert self.m_remote.get_file.called == False
|
114
|
-
|
115
|
-
def teardown(self):
|
116
|
-
os.remove(self.core_dump_path)
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import pytest
|
2
|
-
|
3
|
-
|
4
|
-
class TestLocking(object):
|
5
|
-
|
6
|
-
def test_correct_os_type(self, ctx, config):
|
7
|
-
os_type = ctx.config.get("os_type")
|
8
|
-
if os_type is None:
|
9
|
-
pytest.skip('os_type was not defined')
|
10
|
-
for remote in ctx.cluster.remotes.keys():
|
11
|
-
assert remote.os.name == os_type
|
12
|
-
|
13
|
-
def test_correct_os_version(self, ctx, config):
|
14
|
-
os_version = ctx.config.get("os_version")
|
15
|
-
if os_version is None:
|
16
|
-
pytest.skip('os_version was not defined')
|
17
|
-
if ctx.config.get("os_type") == "debian":
|
18
|
-
pytest.skip('known issue with debian versions; see: issue #10878')
|
19
|
-
for remote in ctx.cluster.remotes.keys():
|
20
|
-
assert remote.inventory_info['os_version'] == os_version
|
21
|
-
|
22
|
-
def test_correct_machine_type(self, ctx, config):
|
23
|
-
machine_type = ctx.machine_type
|
24
|
-
for remote in ctx.cluster.remotes.keys():
|
25
|
-
assert remote.machine_type in machine_type
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import logging
|
2
|
-
import pytest
|
3
|
-
|
4
|
-
from io import StringIO
|
5
|
-
|
6
|
-
from teuthology.exceptions import CommandFailedError
|
7
|
-
|
8
|
-
log = logging.getLogger(__name__)
|
9
|
-
|
10
|
-
|
11
|
-
class TestRun(object):
|
12
|
-
"""
|
13
|
-
Tests to see if we can make remote procedure calls to the current cluster
|
14
|
-
"""
|
15
|
-
|
16
|
-
def test_command_failed_label(self, ctx, config):
|
17
|
-
result = ""
|
18
|
-
try:
|
19
|
-
ctx.cluster.run(
|
20
|
-
args=["python3", "-c", "assert False"],
|
21
|
-
label="working as expected, nothing to see here"
|
22
|
-
)
|
23
|
-
except CommandFailedError as e:
|
24
|
-
result = str(e)
|
25
|
-
|
26
|
-
assert "working as expected" in result
|
27
|
-
|
28
|
-
def test_command_failed_no_label(self, ctx, config):
|
29
|
-
with pytest.raises(CommandFailedError):
|
30
|
-
ctx.cluster.run(
|
31
|
-
args=["python3", "-c", "assert False"],
|
32
|
-
)
|
33
|
-
|
34
|
-
def test_command_success(self, ctx, config):
|
35
|
-
result = StringIO()
|
36
|
-
ctx.cluster.run(
|
37
|
-
args=["python3", "-c", "print('hi')"],
|
38
|
-
stdout=result
|
39
|
-
)
|
40
|
-
assert result.getvalue().strip() == "hi"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|