From 014a4b881926cd66d845c1850eb3df174d49e25e Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Thu, 14 Jul 2016 13:40:35 +0200 Subject: Add support to push the results to the DB JIRA: SDNVPN-19 The test scripts now return a json object with the following format: {"status": criteria, "details": results} where criteria: "PASS"|"FAILED" (result of the test case) details: free output that will be printed to the console and pushed to the DB Change-Id: I9e5e0c3b6cb5f4b060929b71a06f6e4f95f814fb Signed-off-by: jose.lausuch --- test/functest/tempest.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'test/functest/tempest.py') diff --git a/test/functest/tempest.py b/test/functest/tempest.py index 8d4b664..832cb4a 100644 --- a/test/functest/tempest.py +++ b/test/functest/tempest.py @@ -15,7 +15,14 @@ import shutil import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils -logger = ft_logger.Logger("bgpvpn").getLogger() + +logger = ft_logger.Logger("sdnvpn-tempest").getLogger() + +REPO_PATH = os.environ['repos_dir'] + '/sdnvpn/' +config_file = REPO_PATH + 'test/functest/config.yaml' + +SUCCESS_CRITERIA = ft_utils.get_parameter_from_yaml( + "testcases.testcase_1.succes_criteria", config_file) def main(): @@ -68,11 +75,13 @@ def main(): # Look for name of the tests testcases = re.findall("\{0\} (.*)", output) - results = {"test_name": "tempest", "duration": duration, + results = {"duration": duration, "num_tests": num_tests, "failed": failed, "tests": testcases} - logger.info("Results: %s" % results) - return results + status = "PASS" + if 100 - (100 * int(failed) / int(num_tests)) < int(SUCCESS_CRITERIA): + status = "FAILED" + return {"status": status, "details": results} except: logger.error("Problem when parsing the results.") -- cgit 1.2.3-korg