Skip to content

Commit e722038

Browse files
authored
Improve robustness of SCS test suite (#1227)
* Improve robustness of scs-test-runner.py by saving report before uploading If upload fails, the report won't be lost. * Improve robustness of openstack_test.py by reporting tests as ABORT ... when pre-flight checks fail. --------- Signed-off-by: Matthias Büchse <matthias.buechse@alasca.cloud>
1 parent 1faeb6d commit e722038

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

Tests/iaas/openstack_test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def harness(name, *check_fns):
231231
print(f"{name}: {result}")
232232

233233

234-
def run_sanity_checks(container):
234+
def run_preflight_checks(container):
235235
# make sure that we can connect to the cloud and that the user doesn't have elevated privileges
236236
# the former would lead to each testcase aborting with a marginally useful message;
237237
# the latter would lead to scs_0116_permissions aborting, which we don't want to single out
@@ -278,7 +278,13 @@ def main(argv):
278278
sys.exit(1)
279279

280280
c = make_container(cloud)
281-
run_sanity_checks(c)
281+
try:
282+
run_preflight_checks(c)
283+
except Exception:
284+
logger.critical("Pre-flight checks failed. Reporting all testcases as ABORT.")
285+
for testcase in testcases:
286+
print(f"{testcase}: ABORT")
287+
raise
282288
for testcase in testcases:
283289
harness(testcase, lambda: getattr(c, testcase.replace('-', '_')))
284290
return 0

Tests/scs-test-runner.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,12 @@ def run(cfg, scopes, subjects, sections, preset, num_workers, monitor_url, repor
219219
commands = [cfg.build_check_command(job[0], job[1], sections, output) for job, output in zip(jobs, outputs)]
220220
_run_commands(commands, num_workers=num_workers)
221221
_concat_files(outputs, report_yaml_tmp)
222-
subprocess.run(**cfg.build_sign_command(report_yaml_tmp))
223-
subprocess.run(**cfg.build_upload_command(report_yaml_tmp, monitor_url))
224-
if report_yaml is not None:
222+
if report_yaml is None:
223+
report_yaml = report_yaml_tmp
224+
else:
225225
_move_file(report_yaml_tmp, report_yaml)
226+
subprocess.run(**cfg.build_sign_command(report_yaml))
227+
subprocess.run(**cfg.build_upload_command(report_yaml, monitor_url))
226228
return 0
227229

228230

0 commit comments

Comments
 (0)