summaryrefslogtreecommitdiffstats
path: root/dovetail/report.py
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2017-03-22 05:25:54 -0400
committerMatthewLi <matthew.lijun@huawei.com>2017-04-01 00:02:50 -0400
commitfc04c41594a8f30e2e79b1e452b87844ee077f30 (patch)
tree57d81d88bc288505a8b0eae722209972553ea546 /dovetail/report.py
parentaa8654d4f3f727f99016aaa540c8d5aa3f79edcb (diff)
refstack result parse
JIRA: DOVETAIL-375 1, together with other testsuite from functest, such as tempest etc. this should merge after https://gerrit.opnfv.org/gerrit/#/c/31313/ 2, delete some unnecessary definition 3, bugfix of docker cp inside container, see https://build.opnfv.org/ci/view/dovetail/job/dovetail-compass-baremetal-debug-master/361/console 4, disable tempest testcaes since changed to refstack_defcore Change-Id: I67503e348af4a3f697f1b4106bfe81c05add8aa0 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'dovetail/report.py')
-rw-r--r--dovetail/report.py57
1 files changed, 27 insertions, 30 deletions
diff --git a/dovetail/report.py b/dovetail/report.py
index deabbdd2..6c45e00c 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -245,42 +245,39 @@ class FunctestCrawler(object):
'details': {"timestart": timestart,
"duration": testcase_duration,
"tests": '', "failures": ''}}
- elif 'tempest' in testcase_name:
+ elif testcase_name in dt_cfg.dovetail_config['functest_testsuite']:
file_path = \
os.path.join(dovetail_config['result_dir'],
- dovetail_config[self.type]['result']['tp_path'])
+ dovetail_config[self.type]['result']['file_path'])
if not os.path.exists(file_path):
self.logger.info('result file not found: %s', file_path)
return None
- with open(file_path, 'r') as myfile:
- output = myfile.read()
-
- match = re.findall('(.*?)[. ]*fail ', output)
- if match:
- error_logs = " ".join(match)
- else:
- error_logs = ""
- match = re.findall('(.*?)[. ]*skip:', output)
- if match:
- skipped = " ".join(match)
- else:
- skipped = ""
+ tests = 0
+ failed_num = 0
+ error_case = ''
+ skipped_case = ''
+ with open(file_path, 'r') as f:
+ for jsonfile in f:
+ try:
+ data = json.loads(jsonfile)
+ if testcase_name == data['case_name']:
+ criteria = data['details']['status']
+ timestart = data['details']['timestart']
+ testcase_duration = data['details']['duration']
+ tests = data['details']['tests']
+ failed_num = data['details']['failures']
+ error_case = data['details']['errors']
+ skipped_case = data['details']['skipped']
+ except Exception:
+ continue
- match = re.findall(' - Failures: (\d*)', output)
- if match:
- failed_num = int(match[0])
- else:
- failed_num = 0
- if failed_num == 0:
- criteria = 'PASS'
-
- match = re.findall('Ran: (\d*) tests in (\d*)\.\d* sec.', output)
- num_tests, dur_sec_int = match[0]
- json_results = {'criteria': criteria, 'details': {"timestart": '',
- "duration": int(dur_sec_int),
- "tests": int(num_tests), "failures": failed_num,
- "errors": error_logs,
- "skipped": skipped}}
+ json_results = {'criteria': criteria,
+ 'details': {"timestart": timestart,
+ "duration": testcase_duration,
+ "tests": tests,
+ "failures": failed_num,
+ "errors": error_case,
+ "skipped": skipped_case}}
self.logger.debug('Results: %s', str(json_results))
return json_results