summaryrefslogtreecommitdiffstats
path: root/utils/test
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-06-17 14:08:43 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-06-17 14:08:43 +0800
commitf55c9c6a3e694ec76927544ea03643f9aa6f29a8 (patch)
tree378726e470cd7d6ccca02ab3ac745b93f0a58b82 /utils/test
parentad1e7d2a89db7a0b2f29208850f12eca644a9902 (diff)
bugfix: _convert_duration error when encounter ':00:00.078149'
JIRA: FUNCTEST-319 Change-Id: I376045d5d2966f143a3f5db1473e2c10a0869200 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test')
-rw-r--r--utils/test/scripts/mongo_to_elasticsearch.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/test/scripts/mongo_to_elasticsearch.py b/utils/test/scripts/mongo_to_elasticsearch.py
index 51b6913f7..193a6a55b 100644
--- a/utils/test/scripts/mongo_to_elasticsearch.py
+++ b/utils/test/scripts/mongo_to_elasticsearch.py
@@ -45,9 +45,16 @@ def _get_results_from_list_of_dicts(list_of_dict_statuses, dict_indexes, expecte
return test_results
+def _convert_value(value):
+ return value if value != '' else 0
+
+
def _convert_duration(duration):
if (isinstance(duration, str) or isinstance(duration, unicode)) and ':' in duration:
hours, minutes, seconds = duration.split(":")
+ hours = _convert_value(hours)
+ minutes = _convert_value(minutes)
+ seconds = _convert_value(seconds)
int_duration = 3600 * int(hours) + 60 * int(minutes) + float(seconds)
else:
int_duration = duration