Skip to content

Commit b932211

Browse files
authored
Merge branch 'main' into issue/1082
2 parents c04d788 + 7a2d25d commit b932211

16 files changed

Lines changed: 157 additions & 685 deletions

Tests/iaas/openstack_test.py

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

229229

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

276276
c = make_container(cloud)
277-
run_sanity_checks(c)
277+
try:
278+
run_preflight_checks(c)
279+
except Exception:
280+
logger.critical("Pre-flight checks failed. Reporting all testcases as ABORT.")
281+
for testcase in testcases:
282+
print(f"{testcase}: ABORT")
283+
raise
278284
for testcase in testcases:
279285
harness(testcase, lambda: getattr(c, testcase.replace('-', '_')))
280286
return 0

Tests/iaas/scs_0101_entropy/entropy_check.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,28 +74,28 @@ def compute_scs_0101_entropy_avail(collected_vm_output, image_name):
7474
def compute_scs_0101_fips_test(collected_vm_output, image_name):
7575
"""This test ensures that the 'fips test' via `rngtest` is passed on a test VM."""
7676
lines = collected_vm_output['fips-test']
77-
try:
78-
fips_data = '\n'.join(lines)
79-
failure_re = re.search(r'failures:\s\d+', fips_data, flags=re.MULTILINE)
80-
if failure_re:
81-
fips_failures = failure_re.string[failure_re.regs[0][0]:failure_re.regs[0][1]].split(" ")[1]
82-
if int(fips_failures) <= 3:
83-
return True # strict test passed
84-
logger.info(
85-
f"VM '{image_name}' didn't pass the strict FIPS 140-2 testing. "
86-
f"Expected a maximum of 3 failures, got {fips_failures}."
87-
)
88-
if int(fips_failures) <= 5:
89-
return True # lenient test passed
90-
logger.error(
91-
f"VM '{image_name}' didn't pass the FIPS 140-2 testing. "
92-
f"Expected a maximum of 5 failures, got {fips_failures}."
93-
)
94-
else:
95-
logger.error(f"VM '{image_name}': failed to determine fips failures")
96-
logger.debug(f"stderr following:\n{fips_data}")
97-
except BaseException:
98-
logger.critical(f"Couldn't check VM '{image_name}' requirements", exc_info=True)
77+
fips_data = '\n'.join(lines)
78+
failure_re = re.search(r'failures:\s\d+', fips_data, flags=re.MULTILINE)
79+
if not failure_re:
80+
# It seems possible that 'failures: 0' is just omitted, and we could check for
81+
# 'successes: 1000' to verify that, but I have observed this only once in many
82+
# many runs over multiple years. I'm inclined to label this 'inconclusive'
83+
# instead of making the code more complex and risking false certainty.
84+
logger.debug(f"failed to determine fips failures; stderr following:\n{fips_data}")
85+
raise RuntimeError(f"VM '{image_name}': failed to determine fips failures")
86+
fips_failures = failure_re.string[failure_re.regs[0][0]:failure_re.regs[0][1]].split(" ")[1]
87+
if int(fips_failures) <= 3:
88+
return True # strict test passed
89+
logger.info(
90+
f"VM '{image_name}' didn't pass the strict FIPS 140-2 testing. "
91+
f"Expected a maximum of 3 failures, got {fips_failures}."
92+
)
93+
if int(fips_failures) <= 5:
94+
return True # lenient test passed
95+
logger.error(
96+
f"VM '{image_name}' didn't pass the FIPS 140-2 testing. "
97+
f"Expected a maximum of 5 failures, got {fips_failures}."
98+
)
9999
return False # any unsuccessful path should end up here
100100

101101

Tests/kaas/k8s-version-recency/config.yaml.template

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)