Skip to content

Commit 94e15da

Browse files
committed
add testcase result output to checks for key manager and volume types
Signed-off-by: Matthias Büchse <[email protected]>
1 parent 036a96e commit 94e15da

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Tests/iaas/key-manager/check-for-key-manager.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,16 @@ def main():
127127
# parse cloud name for lookup in clouds.yaml
128128
cloud = args.os_cloud or os.environ.get("OS_CLOUD", None)
129129
if not cloud:
130-
raise RuntimeError(
130+
logger.critical(
131131
"You need to have the OS_CLOUD environment variable set to your cloud "
132132
"name or pass it via --os-cloud"
133133
)
134+
return 2
134135

135136
with openstack.connect(cloud=cloud) as conn:
136137
if not check_for_member_role(conn):
137138
logger.critical("Cannot test key-manager permissions. User has wrong roles")
138-
return 1
139+
return 2
139140
if check_presence_of_key_manager(conn):
140141
return check_key_manager_permissions(conn)
141142
else:
@@ -145,9 +146,11 @@ def main():
145146

146147
if __name__ == "__main__":
147148
try:
148-
sys.exit(main())
149-
except SystemExit:
149+
sys.exit(main() or 0)
150+
except SystemExit as e:
151+
if e.code < 2:
152+
print("key-manager-check: " + ('PASS', 'FAIL')[min(1, e.code)])
150153
raise
151154
except BaseException:
152155
logger.critical("exception", exc_info=True)
153-
sys.exit(1)
156+
sys.exit(2)

Tests/iaas/volume-types/volume-types-check.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ def main(argv):
141141
"Total critical / error / warning: "
142142
f"{c[logging.CRITICAL]} / {c[logging.ERROR]} / {c[logging.WARNING]}"
143143
)
144+
if not c[logging.CRITICAL]:
145+
print("volume-types-check: " + ('PASS', 'FAIL')[min(1, c[logging.ERROR])])
144146
return min(127, c[logging.CRITICAL] + c[logging.ERROR]) # cap at 127 due to OS restrictions
145147

146148

0 commit comments

Comments
 (0)