'nb tests': total_nb_tests,
'nb success': success_rate}})
- # Generate json results for DB
- # json_results = {"timestart": time_start, "duration": total_duration,
- # "tests": int(total_nb_tests),
- # "success": int(total_success)}
- # logger.info("Results: "+str(json_results))
-
- # Evaluation of the success criteria
- status = "FAIL"
- # for Rally we decided that the overall success rate must be above 90%
- if float(success_rate) >= 90:
- status = "PASS"
-
if args.sanity:
case_name = "rally_sanity"
else:
case_name = "rally_full"
+ # Evaluation of the success criteria
+ status = functest_utils.check_success_rate(case_name, success_rate)
+
if args.report:
logger.debug("Pushing Rally summary into DB...")
functest_utils.push_results_to_db("functest",
raise ValueError("The parameter %s is not defined in"
" config_functest.yaml" % parameter)
return value
+
+
+def check_success_rate(case_name, success_rate):
+ success_rate = float(success_rate)
+ criteria = get_criteria_by_test(case_name)
+
+ def get_value(op):
+ return float(criteria.split(op)[1].rstrip('%'))
+
+ status = 'FAIL'
+ ops = ['==', '>=']
+ for op in ops:
+ if op in criteria:
+ c_value = get_value(op)
+ if eval("%s %s %s" % (success_rate, op, c_value)):
+ status = 'PASS'
+ break
+
+ return status