From 087038e8e9a2a07f9bb4b2845ec9f5c4b518e468 Mon Sep 17 00:00:00 2001 From: Luka Peschke Date: Wed, 13 Feb 2019 18:11:57 +0100 Subject: [PATCH] Fix InfluxDB storage total() method pagination Change-Id: I135e0a5ba02ee84dd057ab0fa7c2a2c6f47f2e7b --- cloudkitty/storage/v2/influx.py | 2 +- cloudkitty/tests/storage/v2/test_storage_unit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudkitty/storage/v2/influx.py b/cloudkitty/storage/v2/influx.py index 0bf08bde..03b2a6a2 100644 --- a/cloudkitty/storage/v2/influx.py +++ b/cloudkitty/storage/v2/influx.py @@ -365,5 +365,5 @@ class InfluxStorage(v2_storage.BaseStorage): output.sort(key=lambda x: [x[group] for group in groupby]) return { 'total': len(output), - 'results': output[offset:limit] if paginate else output, + 'results': output[offset:offset + limit] if paginate else output, } diff --git a/cloudkitty/tests/storage/v2/test_storage_unit.py b/cloudkitty/tests/storage/v2/test_storage_unit.py index 8963b54e..c1845e0a 100644 --- a/cloudkitty/tests/storage/v2/test_storage_unit.py +++ b/cloudkitty/tests/storage/v2/test_storage_unit.py @@ -244,7 +244,7 @@ class StorageUnitTest(TestCase): begin=begin, end=end, offset=offset, - limit=offset + 2, + limit=2, groupby=['type']) # there are seven metric types self.assertEqual(chunk['total'], 7)