diff --git a/rally/verification/tempest/json2html.py b/rally/verification/tempest/json2html.py index 38892ffe11..c29894d140 100644 --- a/rally/verification/tempest/json2html.py +++ b/rally/verification/tempest/json2html.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +import datetime import re from jinja2 import utils @@ -51,7 +52,9 @@ def generate_report(results): return template.render(report={ "tests": tests, "total": results["tests"], - "time": results["time"], + "time": "{0} ({1} s)".format( + datetime.timedelta(seconds=round( + float(results["time"]))), results["time"]), "success": results["success"], "failures": results["failures"], "skipped": results["skipped"], diff --git a/tests/unit/verification/test_json2html.py b/tests/unit/verification/test_json2html.py index e79e9fcff2..ed343609d1 100644 --- a/tests/unit/verification/test_json2html.py +++ b/tests/unit/verification/test_json2html.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import datetime + import mock from rally.verification.tempest import json2html @@ -23,7 +25,7 @@ class HtmlOutputTestCase(test.TestCase): @mock.patch(BASE + ".json2html.ui_utils.get_template") def test_generate_report(self, mock_get_template): results = { - "time": 22, + "time": 22.75, "tests": 4, "success": 1, "skipped": 1, @@ -50,7 +52,8 @@ class HtmlOutputTestCase(test.TestCase): "expected_failures": 0, "unexpected_success": 0, "total": 4, - "time": 22, + "time": "{0} ({1} s)".format( + datetime.timedelta(seconds=23), 22.75), "tests": [{"name": "tf", "id": 0, "output": "fail_log", @@ -96,7 +99,7 @@ class HtmlOutputTestCase(test.TestCase): "expected_failures": 0, "unexpected_success": 0, "total": 1, - "time": 0, + "time": "{0} ({1} s)".format(datetime.timedelta(seconds=0), 0), "tests": [{ "id": 0, "status": "skip",