summaryrefslogtreecommitdiffstats
path: root/dovetail/run.py
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2019-04-03 05:33:24 -0400
committerxudan <xudan16@huawei.com>2019-04-03 22:25:59 -0400
commit06a0a8f2bd8ee7ce7db154c54301ec986b93b89f (patch)
tree89bd74978b9d9c4b107b4a617d557a60c95007a7 /dovetail/run.py
parenteb86745284805f2943d4733bb029948be760d597 (diff)
Push CI results to OPNFV test DB
In order to use OPNFV test results page to do the ayalysis of all OVP test cases, it needs to push all results generated by Dovetail CI jobs to test DB and then using http://testresults.opnfv.org/test/#/results to check all results. The following data must contain in the POST body: 1. project_name 2. case_name 3. details 4. installer 5. scenario 6. pod_name 7. build_tag 8. criteria 9. start_date 10. stop_date 11. version JIRA: DOVETAIL-767 Change-Id: I925ae249e24efd7bfb1c68a69150e9c22f0cdf36 Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/run.py')
-rwxr-xr-xdovetail/run.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/dovetail/run.py b/dovetail/run.py
index 71a69687..c83c1973 100755
--- a/dovetail/run.py
+++ b/dovetail/run.py
@@ -11,6 +11,7 @@
import copy
+from datetime import datetime
import os
import time
import uuid
@@ -48,10 +49,20 @@ def run_test(testcase_list, report_flag, logger):
testcase = dt_testcase.Testcase.get(testcase_name)
run_testcase = True
+ tc_start_time = datetime.fromtimestamp(
+ time.time()).strftime('%Y-%m-%d %H:%M:%S')
if run_testcase:
testcase.run()
+ tc_stop_time = datetime.fromtimestamp(
+ time.time()).strftime('%Y-%m-%d %H:%M:%S')
result = report.check_tc_result(testcase)
+ if os.getenv('OPNFV_CI') == 'true':
+ dt_utils.push_results_to_db(case_name=testcase_name,
+ start_date=tc_start_time,
+ stop_date=tc_stop_time,
+ details=result,
+ logger=logger)
if dt_cfg.dovetail_config['stop']:
try:
if (not result or result['criteria'] == 'FAIL'):
@@ -248,8 +259,8 @@ def main(*args, **kwargs):
if not get_result_path():
return
clean_results_dir()
- if kwargs['debug']:
- os.environ['DEBUG'] = 'true'
+ os.environ['DEBUG'] = 'true' if kwargs['debug'] else 'false'
+ os.environ['OPNFV_CI'] = 'true' if kwargs['opnfv_ci'] else 'false'
create_logs()
logger = dt_logger.Logger('run').getLogger()