Fix InfluxDB storage total() method pagination

Change-Id: I135e0a5ba02ee84dd057ab0fa7c2a2c6f47f2e7b
This commit is contained in:
Luka Peschke 2019-02-13 18:11:57 +01:00
parent be38ba70f9
commit 087038e8e9
2 changed files with 2 additions and 2 deletions

View File

@ -365,5 +365,5 @@ class InfluxStorage(v2_storage.BaseStorage):
output.sort(key=lambda x: [x[group] for group in groupby]) output.sort(key=lambda x: [x[group] for group in groupby])
return { return {
'total': len(output), 'total': len(output),
'results': output[offset:limit] if paginate else output, 'results': output[offset:offset + limit] if paginate else output,
} }

View File

@ -244,7 +244,7 @@ class StorageUnitTest(TestCase):
begin=begin, begin=begin,
end=end, end=end,
offset=offset, offset=offset,
limit=offset + 2, limit=2,
groupby=['type']) groupby=['type'])
# there are seven metric types # there are seven metric types
self.assertEqual(chunk['total'], 7) self.assertEqual(chunk['total'], 7)