Commit f3f875fd authored by Hardik Juneja's avatar Hardik Juneja Committed by Rafael Monnerat

check_apachedex_result: make sure threshold is of type float

/reviewed-on nexedi/slapos.toolbox!26
parent 63a514f8
...@@ -36,10 +36,9 @@ def checkApachedexResult(apachedex_path, apachedex_report_status_file, desired_t ...@@ -36,10 +36,9 @@ def checkApachedexResult(apachedex_path, apachedex_report_status_file, desired_t
if m: if m:
apx_result=int(m[0]) apx_result=int(m[0])
if apx_result > desired_threshold: if apx_result > desired_threshold:
return 0, "Thanks for keeping it all clean, result is " + str(apx_result) return 0, "Thanks for keeping it all clean, result is %s" % apx_result
else: else:
return 1, "Threshold is lower than expected: Expected was " + \ return 1, "Threshold is lower than expected: Expected was %f and current result is %s" % (desired_threshold, apx_result)
str(desired_threshold) +" and current result is " + str(apx_result)
message = "No result found in the apdex file or the file is corrupted" message = "No result found in the apdex file or the file is corrupted"
break break
...@@ -56,7 +55,7 @@ def main(): ...@@ -56,7 +55,7 @@ def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--apachedex_path", required=True) parser.add_argument("--apachedex_path", required=True)
parser.add_argument("--status_file", required=True) parser.add_argument("--status_file", required=True)
parser.add_argument("--threshold", required=True) parser.add_argument("--threshold", required=True, type=float)
args = parser.parse_args() args = parser.parse_args()
status, message = checkApachedexResult(args.apachedex_path, args.status_file, args.threshold) status, message = checkApachedexResult(args.apachedex_path, args.status_file, args.threshold)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment