Skip to content

Commit

Permalink
Improve prometheus-based verification reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
celskeggs committed Jan 25, 2018
1 parent c4addfa commit 2b6a442
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion building/build-debs/homeworld-admin-tools/src/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ def pull_prometheus_query(query):
if data.get("resultType") != "vector":
command.fail("prometheus query did not produce a vector")
result_vec = data["result"]
if type(result_vec) != list or len(result_vec) != 1:
if type(result_vec) != list or len(result_vec) > 1:
command.fail("prometheus query returned %d results instead of 1" % len(result_vec))
if not result_vec:
command.fail("no results from prometheus query '%s'" % query)
if type(result_vec[0]) != dict or "value" not in result_vec[0] or len(result_vec[0]["value"]) != 2:
command.fail("unexpected format of result")
return result_vec[0]["value"][1]
Expand Down

0 comments on commit 2b6a442

Please sign in to comment.