summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-06-17 07:32:29 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-06-17 07:32:29 +0000
commit13f8885f134e36ca9ccde367cdedfc4c68cf7766 (patch)
tree172e471e3c78aea09d3200f9bf78add0dbdbdb78
parent573b1f12a56f0c13d5c552fceb326bfdec5f2ee7 (diff)
parentf55c9c6a3e694ec76927544ea03643f9aa6f29a8 (diff)
Merge "bugfix: _convert_duration error when encounter ':00:00.078149'"
-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 44f79efbe..caa68d8d0 100644
--- a/utils/test/scripts/mongo_to_elasticsearch.py
+++ b/utils/test/scripts/mongo_to_elasticsearch.py
@@ -48,9 +48,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