diff options
author | xudan <xudan16@huawei.com> | 2017-03-30 10:23:01 +0000 |
---|---|---|
committer | xudan <xudan16@huawei.com> | 2017-03-31 02:29:51 +0000 |
commit | 8bde91d7e2b58b5313f0b069b052cda82915b6b5 (patch) | |
tree | 6158b6fb8e5b888d6b2b45aaa2fb7cf34c62cb06 /dovetail/run.py | |
parent | aa8654d4f3f727f99016aaa540c8d5aa3f79edcb (diff) |
dovetail tool: check push_to_db success or fail
JIRA: DOVETAIL-380
If Functest fails to push results to db, there is just an error log in functest.log
Dovetail needs to know the failure.
Dovetail will get the results from db with keys, build_tag and testcase.
If it can get the results data, it means push_to_db success.
Fix the duration time wrong.
Change-Id: If03bdf0ceb2f1a9d422381cdf06e1fd207358bd5
Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/run.py')
-rwxr-xr-x | dovetail/run.py | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/dovetail/run.py b/dovetail/run.py index 828a2b70..78e085eb 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -44,6 +44,7 @@ def run_test(testsuite, testarea, logger): testarea_list.append(value) duration = 0 + start_time = time.time() for testcase_name in testarea_list: logger.info('>>[testcase]: %s', testcase_name) testcase = Testcase.get(testcase_name) @@ -60,21 +61,33 @@ def run_test(testsuite, testarea, logger): run_testcase = False if run_testcase: - start_time = time.time() testcase.run() - end_time = time.time() - duration = end_time - start_time - if dt_cfg.dovetail_config['report_dest'].startswith("http"): - logger.info("Results has been pushed to database.") - if dt_cfg.dovetail_config['report_dest'] == "file": - logger.info("Results has been stored with files.") - result = Report.get_result(testcase) - Report.check_result(testcase, result) + check_tc_result(testcase, logger) + end_time = time.time() + duration = end_time - start_time return duration +def check_tc_result(testcase, logger): + if dt_cfg.dovetail_config['report_dest'].startswith("http"): + if testcase.validate_type() == 'yardstick': + logger.info("Results have been stored with files.") + else: + if dt_utils.check_db_results(dt_cfg.dovetail_config['report_dest'], + dt_cfg.dovetail_config['build_tag'], + testcase.validate_testcase(), + logger): + logger.info("Results have been pushed to database.") + else: + logger.error("Fail to push results to database.") + if dt_cfg.dovetail_config['report_dest'] == "file": + logger.info("Results have been stored with files.") + result = Report.get_result(testcase) + Report.check_result(testcase, result) + + def validate_input(input_dict, check_dict, logger): # for 'func_tag' and 'yard_tag' options func_tag = input_dict['func_tag'] |