fix metrics json response test

This commit is contained in:
Lex Berezhny 2019-07-17 22:40:02 -04:00
parent 88adf3ee27
commit ffe6418392
2 changed files with 3 additions and 3 deletions

View file

@ -120,11 +120,11 @@ class ServerLoadData:
self._apis[name] = APICallMetrics(name) self._apis[name] = APICallMetrics(name)
return self._apis[name] return self._apis[name]
def to_json_and_reset(self, server): def to_json_and_reset(self, status):
try: try:
return { return {
'api': {name: api.to_json_and_reset() for name, api in self._apis.items()}, 'api': {name: api.to_json_and_reset() for name, api in self._apis.items()},
'server': server 'status': status
} }
finally: finally:
self._apis = {} self._apis = {}

View file

@ -59,4 +59,4 @@ class TestCollectingMetrics(unittest.TestCase):
'wait_avg': 12, 'wait_avg': 12,
'wait_percentiles': (10, 10, 10, 12, 14, 15, 15) 'wait_percentiles': (10, 10, 10, 12, 14, 15, 15)
}}}) }}})
self.assertEqual(load.to_json_and_reset({}), {'api': {}}) self.assertEqual(load.to_json_and_reset({}), {'status': {}, 'api': {}})