fix metrics json response test
This commit is contained in:
parent
88adf3ee27
commit
ffe6418392
2 changed files with 3 additions and 3 deletions
|
@ -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 = {}
|
||||||
|
|
|
@ -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': {}})
|
||||||
|
|
Loading…
Add table
Reference in a new issue