+ with open(results_file_name, 'r') as results_file:
+ data = results_file.read()
+ logger.debug("\n%s" % data)
+ json_data = json.loads(data)
+
+ suites = json_data["stats"]["suites"]
+ tests = json_data["stats"]["tests"]
+ passes = json_data["stats"]["passes"]
+ pending = json_data["stats"]["pending"]
+ failures = json_data["stats"]["failures"]
+ start_time_json = json_data["stats"]["start"]
+ end_time = json_data["stats"]["end"]
+ duration = float(json_data["stats"]["duration"]) / float(1000)
+
+ logger.info("\n"
+ "****************************************\n"
+ " Promise test report\n\n"
+ "****************************************\n"
+ " Suites: \t%s\n"
+ " Tests: \t%s\n"
+ " Passes: \t%s\n"
+ " Pending: \t%s\n"
+ " Failures:\t%s\n"
+ " Start: \t%s\n"
+ " End: \t%s\n"
+ " Duration:\t%s\n"
+ "****************************************\n\n"
+ % (suites, tests, passes, pending, failures,
+ start_time_json, end_time, duration))
+
+ if args.report:
+ stop_time = time.time()
+ json_results = {"timestart": start_time, "duration": duration,
+ "tests": int(tests), "failures": int(failures)}
+ logger.debug("Promise Results json: " + str(json_results))
+
+ # criteria for Promise in Release B was 100% of tests OK
+ status = "FAIL"
+ if int(tests) > 32 and int(failures) < 1:
+ status = "PASS"
+ exit_code = 0
+
+ functest_utils.push_results_to_db("promise",
+ "promise",
+ logger,
+ start_time,
+ stop_time,
+ status,
+ json_results)
+
+ exit(exit_code)