Skip to content

Commit f05cd36

Browse files
author
Prasanna Santhanam
committed
marvin: assertions with messages for common.py
1 parent fd6be7a commit f05cd36

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎tools/marvin/marvin/integration/lib/common.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def get_zone(apiclient, services=None):
8181
zones = apiclient.listZones(cmd)
8282

8383
if isinstance(zones, list):
84-
assert len(zones) > 0
84+
assert len(zones) > 0, "There are no available zones in the deployment"
8585
return zones[0]
8686
else:
8787
raise Exception("Failed to find specified zone.")
@@ -100,7 +100,7 @@ def get_pod(apiclient, zoneid, services=None):
100100
pods = apiclient.listPods(cmd)
101101

102102
if isinstance(pods, list):
103-
assert len(pods) > 0
103+
assert len(pods) > 0, "No pods found for zone %s"%zoneid
104104
return pods[0]
105105
else:
106106
raise Exception("Exception: Failed to find specified pod.")
@@ -129,10 +129,11 @@ def get_template(apiclient, zoneid, ostype, services=None):
129129

130130
list_templates = apiclient.listTemplates(cmd)
131131

132-
assert len(list_templates) > 0
133-
for template in list_templates:
134-
if template.ostypeid == ostypeid:
135-
return template
132+
if isinstance(list_templates, list):
133+
assert len(list_templates) > 0, "received empty response on template of type %s"%ostype
134+
for template in list_templates:
135+
if template.ostypeid == ostypeid:
136+
return template
136137

137138
raise Exception("Exception: Failed to find template with OSTypeID: %s" %
138139
ostypeid)

0 commit comments

Comments
 (0)