From f55c9c6a3e694ec76927544ea03643f9aa6f29a8 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Fri, 17 Jun 2016 14:08:43 +0800 Subject: bugfix: _convert_duration error when encounter ':00:00.078149' JIRA: FUNCTEST-319 Change-Id: I376045d5d2966f143a3f5db1473e2c10a0869200 Signed-off-by: SerenaFeng --- utils/test/scripts/mongo_to_elasticsearch.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'utils/test') 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 -- cgit 1.2.3-korg