aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2016-08-18 10:57:34 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2016-08-19 09:23:01 +0200
commit1cc130c1ed3bc3a27b217daa854030c42dc25a3a (patch)
tree6a0a591e97907fbd9e64dd3dc85bc0eb00b16b93
parent447819bd807b963ea5fbeb14ac4f4ef97f55f0f1 (diff)
Modify data sent to testAPI
It mainly removes prefixes, '#' and '@' and changes details to tests. It deletes useless comments too. Change-Id: I7807a7429a90e7c7c15f8662008a5a768f96be98 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--testcases/Controllers/ODL/odlreport2db.py31
1 files changed, 12 insertions, 19 deletions
diff --git a/testcases/Controllers/ODL/odlreport2db.py b/testcases/Controllers/ODL/odlreport2db.py
index 86f3c5c7..6b3fb913 100644
--- a/testcases/Controllers/ODL/odlreport2db.py
+++ b/testcases/Controllers/ODL/odlreport2db.py
@@ -14,13 +14,6 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
#
-# 0.1: This script boots the VM1 and allocates IP address from Nova
-# Later, the VM2 boots then execute cloud-init to ping VM1.
-# After successful ping, both the VMs are deleted.
-# 0.2: measure test duration and publish results under json format
-# 0.3: adapt push 2 DB after Test API refacroting
-#
-#
import getopt
import json
@@ -42,9 +35,11 @@ def usage():
def populate_detail(test):
detail = {}
- detail['test_name'] = test['@name']
- detail['test_status'] = test['status']
- detail['test_doc'] = test['doc']
+ detail['name'] = test['@name']
+ for x in ['status', 'critical', 'starttime', 'endtime']:
+ detail[x] = test['status']['@' + x]
+ if '#text' in test['status']:
+ detail['text'] = test['status']['#text']
return detail
@@ -65,9 +60,9 @@ def parse_suites(suites):
a = suite['suite']
if type(a) == list:
for b in a:
- data['details'] = parse_test(b['test'], details)
+ data['tests'] = parse_test(b['test'], details)
else:
- data['details'] = parse_test(a['test'], details)
+ data['tests'] = parse_test(a['test'], details)
# data['details'] = parse_test(suite['test'], details)
# suites is not iterable
@@ -101,9 +96,7 @@ def main(argv):
try:
data = parse_suites(all_data['suite']['suite'])
data['description'] = all_data['suite']['@name']
- data['version'] = all_data['@generator']
- data['test_project'] = "functest"
- data['case_name'] = "odl"
+ data['generator'] = all_data['@generator']
json.dumps(data, indent=4, separators=(',', ': '))
@@ -115,8 +108,8 @@ def main(argv):
stop_time = start_time
tests_passed = 0
tests_failed = 0
- for v in data['details']:
- if v['test_status']['@status'] == "PASS":
+ for v in data['tests']:
+ if v['status'] == "PASS":
tests_passed += 1
else:
tests_failed += 1
@@ -124,8 +117,8 @@ def main(argv):
if (tests_failed < 1):
status = "PASS"
- functest_utils.push_results_to_db(data['test_project'],
- data['case_name'],
+ functest_utils.push_results_to_db("functest",
+ "odl",
None,
start_time,
stop_time,