From eb3a83d040357ffa8f3a651b27be6ab8ef6c5a00 Mon Sep 17 00:00:00 2001 From: Manuel Buil Date: Tue, 21 Mar 2017 18:48:23 +0100 Subject: Fix run_tests It was impossible to get a status='PASS' Change-Id: I016346c1acf38ae1a130afbfd132166b72d5e1af Signed-off-by: Manuel Buil (cherry picked from commit d63f9fc8f18f42cd80a32e3b93aed19091beccee) --- sfc/tests/functest/run_tests.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sfc/tests/functest/run_tests.py b/sfc/tests/functest/run_tests.py index 7060599d..a043d191 100644 --- a/sfc/tests/functest/run_tests.py +++ b/sfc/tests/functest/run_tests.py @@ -120,7 +120,7 @@ def main(): testcases_ordered = OrderedDict(sorted(testcases.items(), key=lambda x: x[1]['order'])) overall_details = {} - overall_status = "FAIL" + overall_status = "NOT TESTED" overall_start_time = time.time() for testcase, test_cfg in testcases_ordered.items(): if test_cfg['enabled']: @@ -138,7 +138,7 @@ def main(): except Exception, e: logger.error("Exception when executing: %s" % testcase) logger.error(e) - result = 1 + result = {'status': 'FAILED'} for node in nodes: if node.get_file("/usr/lib/python2.7/dist-packages/tacker/" "sfc/plugin.py", "/tmp/plugin.py"): @@ -151,24 +151,26 @@ def main(): logger.info(fd1.read()) end_time = time.time() duration = end_time - start_time - status = "FAIL" - if result != 0: - overall_details.update({test_name_db: "execution error."}) + logger.info("Results of test case '%s - %s':\n%s\n" % + (test_name, test_descr, result)) + if result['status'] == 'PASS': + status = 'PASS' + overall_details.update({test_name_db: "worked"}) + if overall_status != "FAIL": + overall_status = "PASS" else: - status = result.get("status") - if status == "FAIL": - overall_status = "FAIL" - ovs_logger.create_artifact_archive() - - logger.info("Results of test case '%s - %s':\n%s\n" % - (test_name, test_descr, result)) + status = 'FAIL' + overall_status = "FAIL" + overall_details.update({test_name_db: "execution error."}) + ovs_logger.create_artifact_archive() - dic = {"duration": duration, "status": overall_status} - overall_details.update({test_name_db: dic}) if args.report: details = result.get("details") push_results( test_name_db, start_time, end_time, status, details) + + dic = {"duration": duration, "status": status} + overall_details.update({test_name_db: dic}) sfc_cleanup.cleanup(odl_ip=odl_ip, odl_port=odl_port) overall_end_time = time.time() -- cgit 1.2.3-korg