summaryrefslogtreecommitdiffstats
path: root/utils/test
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-09-05 10:11:21 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-09-05 10:11:21 +0800
commit581921cea95147f3af8abab7df14bb9375fde0fc (patch)
tree8e272286fdbd1a5f81506f43cdd62eff915533de /utils/test
parent9f410cf990048e6388d6f41289ebe6cd70185fc8 (diff)
make mongo_to_elasticsearch.py skip resolve-failed results
mongo_to_elasticsearch.py exit when encounter can-not-be-parsed results, for example: File "mongo_to_elasticsearch.py", line 58, in _convert_duration hours, minutes, seconds = duration.split(":") ValueError: need more than 2 values to unpack File "mongo_to_elasticsearch.py", line 228, in modify_functest_odl test_statuses = _get_dicts_from_list(testcase, testcase['details']['details'], KeyError: 'details' change the logic, try...Except the Exception, logger it as error, then continue processing the rest results Change-Id: I18facd457ba3e8f661f5c9a1da1e6c200af6fc4e Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test')
-rw-r--r--utils/test/scripts/mongo_to_elasticsearch.py42
1 files changed, 24 insertions, 18 deletions
diff --git a/utils/test/scripts/mongo_to_elasticsearch.py b/utils/test/scripts/mongo_to_elasticsearch.py
index 2ffbc1713..ded58ef4c 100644
--- a/utils/test/scripts/mongo_to_elasticsearch.py
+++ b/utils/test/scripts/mongo_to_elasticsearch.py
@@ -1,13 +1,16 @@
#! /usr/bin/env python
-import logging
-import argparse
-import shared_utils
+import datetime
import json
-import urlparse
-import uuid
+import logging
import os
import subprocess
-import datetime
+import traceback
+import urlparse
+import uuid
+
+import argparse
+
+import shared_utils
logger = logging.getLogger('mongo_to_elasticsearch')
logger.setLevel(logging.DEBUG)
@@ -370,18 +373,21 @@ def modify_mongo_entry(testcase):
project = testcase['project_name']
case_name = testcase['case_name']
logger.info("Processing mongo test case '{}'".format(case_name))
- if project == 'functest':
- if case_name == 'rally_sanity':
- return modify_functest_rally(testcase)
- elif case_name.lower() == 'odl':
- return modify_functest_odl(testcase)
- elif case_name.lower() == 'onos':
- return modify_functest_onos(testcase)
- elif case_name.lower() == 'vims':
- return modify_functest_vims(testcase)
- elif case_name == 'tempest_smoke_serial':
- return modify_functest_tempest(testcase)
- return modify_default_entry(testcase)
+ try:
+ if project == 'functest':
+ if case_name == 'rally_sanity':
+ return modify_functest_rally(testcase)
+ elif case_name.lower() == 'odl':
+ return modify_functest_odl(testcase)
+ elif case_name.lower() == 'onos':
+ return modify_functest_onos(testcase)
+ elif case_name.lower() == 'vims':
+ return modify_functest_vims(testcase)
+ elif case_name == 'tempest_smoke_serial':
+ return modify_functest_tempest(testcase)
+ return modify_default_entry(testcase)
+ except Exception:
+ logger.error("Fail in modify testcase[%s]\nerror message: %s" % (testcase, traceback.format_exc()))
else:
return False