From 03fc68820d1badd600832de3b7c6dd72368dd198 Mon Sep 17 00:00:00 2001 From: Morgan Richomme Date: Wed, 8 Jun 2016 15:56:54 +0200 Subject: Adapt functest testcase to APi refactoring JIRA: FUNCTEST-303 Change-Id: Ia276d9ca6e8d62b496c3b5f81561b14b02c43fd7 Signed-off-by: Morgan Richomme --- testcases/Controllers/ODL/odlreport2db.py | 25 ++++++++++++----------- testcases/Controllers/ONOS/Teston/onosfunctest.py | 21 ++++++++++--------- 2 files changed, 24 insertions(+), 22 deletions(-) (limited to 'testcases/Controllers') diff --git a/testcases/Controllers/ODL/odlreport2db.py b/testcases/Controllers/ODL/odlreport2db.py index 8eb78b19a..028808411 100644 --- a/testcases/Controllers/ODL/odlreport2db.py +++ b/testcases/Controllers/ODL/odlreport2db.py @@ -18,6 +18,7 @@ # Later, the VM2 boots then execute cloud-init to ping VM1. # After successful ping, both the VMs are deleted. # 0.2: measure test duration and publish results under json format +# 0.3: adapt push 2 DB after Test API refacroting # # @@ -25,6 +26,7 @@ import getopt import json import os import sys +import time import xmltodict import yaml @@ -125,19 +127,19 @@ def main(argv): functest_yaml = yaml.safe_load(f) f.close() - database = functest_yaml.get("results").get("test_db_url") - build_tag = functest_utils.get_build_tag() - try: # example: # python odlreport2db.py -x ~/Pictures/Perso/odl/output3.xml # -i fuel # -p opnfv-jump-2 # -s os-odl_l2-ha - version = functest_utils.get_version() # success criteria for ODL = 100% of tests OK - status = "failed" + status = "FAIL" + # TODO as part of the tests are executed before in the bash + # start and stoptime have no real meaning + start_time = time.time() + stop_time = start_time try: tests_passed = 0 tests_failed = 0 @@ -148,19 +150,18 @@ def main(argv): tests_failed += 1 if (tests_failed < 1): - status = "passed" + status = "PASS" except: print("Unable to set criteria" % sys.exc_info()[0]) - functest_utils.push_results_to_db(database, - "functest", + + functest_utils.push_results_to_db("functest", data['case_name'], None, - data['pod_name'], - version, - scenario, + start_time, + stop_time, status, - build_tag, data) + except: print("Error pushing results into Database '%s'" % sys.exc_info()[0]) diff --git a/testcases/Controllers/ONOS/Teston/onosfunctest.py b/testcases/Controllers/ONOS/Teston/onosfunctest.py index 07ecacc5d..38935c5dd 100644 --- a/testcases/Controllers/ONOS/Teston/onosfunctest.py +++ b/testcases/Controllers/ONOS/Teston/onosfunctest.py @@ -164,7 +164,8 @@ def CleanOnosTest(): def main(): - + start_time = time.time() + stop_time = start_time DownloadCodes() if args.installer == "joid": logger.debug("Installer is Joid") @@ -175,11 +176,10 @@ def main(): RunScript("FUNCvirNetNBL3") try: - logger.debug("Push result into DB") + logger.debug("Push ONOS results into DB") # TODO check path result for the file - scenario = functest_utils.get_scenario(logger) - version = functest_utils.get_version(logger) result = GetResult() + stop_time = time.time() # ONOS success criteria = all tests OK # i.e. FUNCvirNet & FUNCvirNetL3 @@ -191,13 +191,14 @@ def main(): except: logger.error("Unable to set ONOS criteria") - pod_name = functest_utils.get_pod_name(logger) - build_tag = functest_utils.get_build_tag(logger) - functest_utils.push_results_to_db(TEST_DB, - "functest", + functest_utils.push_results_to_db("functest", "ONOS", - logger, pod_name, version, scenario, - status, build_tag, payload=result) + logger, + start_time, + stop_time, + status, + result) + except: logger.error("Error pushing results into Database") -- cgit 1.2.3-korg