diff options
author | yuyang <Gabriel.yuyang@huawei.com> | 2017-05-26 17:33:56 +0800 |
---|---|---|
committer | Yu Yang (Gabriel) <Gabriel.yuyang@huawei.com> | 2017-06-05 09:35:49 +0000 |
commit | 2df7dda3cafd194ac99154dbd21004d35b8e36d7 (patch) | |
tree | d6184f007421dc680b05e6ab0318154a66fcb9d2 | |
parent | 1dbf2fafe88c6862aa7d89c2a6fad6709f13367f (diff) |
Bugfix: json format transform for report
JIRA: BOTTLENECK-158
The details part of report is not json formatted.
This patch is to fix it.
Change-Id: I089dae0c12e14935e4b7a5e7bdbe69f00e003f98
Signed-off-by: yuyang <Gabriel.yuyang@huawei.com>
(cherry picked from commit e4a17446f0f02d6ea950278074d88db6c09c5bb6)
-rwxr-xr-x | testsuites/posca/run_posca.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/testsuites/posca/run_posca.py b/testsuites/posca/run_posca.py index 18325b04..bd979b67 100755 --- a/testsuites/posca/run_posca.py +++ b/testsuites/posca/run_posca.py @@ -20,6 +20,7 @@ import sys import os from oslo_serialization import jsonutils +import json import requests import datetime @@ -50,8 +51,8 @@ def report(testcase, start_date, stop_date, criteria, details_doc): "installer": os.environ.get('INSTALLER_TYPE', 'unknown'), "version": os.environ.get('BRANCH', 'unknown'), "build_tag": os.environ.get('BUILD_TAG', 'unknown'), - "stop_date": stop_date, - "start_date": start_date, + "stop_date": str(stop_date), + "start_date": str(start_date), "criteria": criteria, "scenario": os.environ.get('DEPLOY_SCENARIO', 'unknown') } @@ -94,11 +95,9 @@ def posca_run(test_level, test_name, REPORT="False"): details_doc = [] if os.path.exists(config[testcase]['out_file']): with open(config[testcase]['out_file']) as details_result: - lines = details_result.readlines() - if len(lines): + details_doc =[json.loads(data) for data in details_result.readlines()] # noqa + if len(details_doc): criteria = "PASS" - for l in lines: - details_doc.append(l.replace('\n', '')) report(testcase, start_date, stop_date, criteria, details_doc) |