From: Boris Ranto Date: Tue, 29 May 2018 21:32:48 +0000 (+0200) Subject: dashboard: Return float if rate not available X-Git-Tag: v14.0.1~1239^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=58ffd146261586b5598c946fd730df0b223294e7;p=ceph.git dashboard: Return float if rate not available This fixes a test case issue when some of the data might not be available during the test, yet. The test expects the second value to be JFloat but that fails because get_rates return an int in that case. Signed-off-by: Boris Ranto --- diff --git a/src/pybind/mgr/dashboard/services/ceph_service.py b/src/pybind/mgr/dashboard/services/ceph_service.py index a2e22f507bbe..174a6ef61c65 100644 --- a/src/pybind/mgr/dashboard/services/ceph_service.py +++ b/src/pybind/mgr/dashboard/services/ceph_service.py @@ -176,9 +176,9 @@ class CephService(object): :rtype: list[tuple[int, float]]""" data = mgr.get_counter(svc_type, svc_name, path)[path] if not data: - return [(0, 0)] + return [(0, 0.0)] elif len(data) == 1: - return [(data[0][0], 0)] + return [(data[0][0], 0.0)] return [(data2[0], differentiate(data1, data2)) for data1, data2 in pairwise(data)] @classmethod