From 16b0481606010f843711cda99bfb6901c1fa1f38 Mon Sep 17 00:00:00 2001 From: Morgan Richomme Date: Thu, 18 Aug 2016 10:15:46 +0200 Subject: bug fix: push moon results to DB Change-Id: Id94147c935f841bc6fa21b0c927912fecad27535 Signed-off-by: Morgan Richomme --- tests/run_tests.py | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'tests') diff --git a/tests/run_tests.py b/tests/run_tests.py index 4d7eacd8..57ef95bc 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -1,18 +1,25 @@ #!/usr/bin/python # Copyright 2015 Open Platform for NFV Project, Inc. and its contributors -# This software is distributed under the terms and conditions of the 'Apache-2.0' -# license which can be found in the file 'LICENSE' in this package distribution +# This software is distributed under the terms and conditions of the +# 'Apache-2.0'license which can be found in the file 'LICENSE' in this +# package distribution # or at 'http://www.apache.org/licenses/LICENSE-2.0'. - +import argparse +import functest.utils.functest_logger as ft_logger +import functest.utils.functest_utils as functest_utils import os import sys import time -import functest.utils.functest_logger as ft_logger -import functest.utils.functest_utils as functest_utils import yaml +parser = argparse.ArgumentParser() + +parser.add_argument("-r", "--report", + help="Create json result file", + action="store_true") +args = parser.parse_args() with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) @@ -46,28 +53,20 @@ def main(): 'duration': duration, 'status': test_status, } - pod_name = functest_utils.get_pod_name(logger) - scenario = functest_utils.get_scenario(logger) - version = functest_utils.get_version(logger) - build_tag = functest_utils.get_build_tag(logger) - - logger.info("Pushing MOON results: TEST_DB_URL=%(db)s pod_name=%(pod)s " - "version=%(v)s scenario=%(s)s criteria=%(c)s details=%(d)s" % { - 'db': TEST_DB_URL, - 'pod': pod_name, - 'v': version, - 's': scenario, - 'c': details['status'], - 'b': build_tag, - 'd': details, - }) - functest_utils.push_results_to_db("MOON", - "MOON-notification", - logger, - start_time, - stop_time, - details['status'], - details) + + functest_utils.logger_test_results(logger, "moon", + "moon_authentication", + test_status, details) + if args.report: + functest_utils.push_results_to_db("moon", + "moon_authentication", + logger, + start_time, + stop_time, + test_status, + details) + logger.info("Moon results pushed to DB") + if ret_val != 0: sys.exit(-1) -- cgit 1.2.3-korg