Fixed issue where filter_dict_list_with_live_query is called too often
Change-Id: Id75ee77c928399059b27309937fc664a61389fa3
This commit is contained in:
parent
4d96462469
commit
b342e820b5
@ -45,7 +45,7 @@ class HostHandler(handler.Handler):
|
||||
|
||||
# Values
|
||||
"state": first_entry['state'],
|
||||
"acknowledged": first_entry['acknowledged'],
|
||||
"acknowledged": int(first_entry['acknowledged']),
|
||||
"last_check": int(first_entry['last_check']),
|
||||
"last_state_change": int(first_entry['last_state_change']),
|
||||
"plugin_output": first_entry['output']
|
||||
@ -53,11 +53,11 @@ class HostHandler(handler.Handler):
|
||||
|
||||
host_dicts.append(host_dict)
|
||||
|
||||
if live_query:
|
||||
host_dicts = query_filter.filter_dict_list_with_live_query(
|
||||
host_dicts,
|
||||
live_query
|
||||
)
|
||||
if live_query:
|
||||
host_dicts = query_filter.filter_dict_list_with_live_query(
|
||||
host_dicts,
|
||||
live_query
|
||||
)
|
||||
|
||||
hosts = []
|
||||
for host_dict in host_dicts:
|
||||
|
@ -43,7 +43,7 @@ class ServiceHandler(handler.Handler):
|
||||
"host_name": item[0][1]['host_name'],
|
||||
"description": item[0][1]['service_description'],
|
||||
"state": first_entry['state'],
|
||||
"acknowledged": first_entry['acknowledged'],
|
||||
"acknowledged": int(first_entry['acknowledged']),
|
||||
"last_check": int(first_entry['last_check']),
|
||||
"last_state_change": int(first_entry['last_state_change']),
|
||||
"plugin_output": first_entry['output']
|
||||
@ -51,11 +51,11 @@ class ServiceHandler(handler.Handler):
|
||||
|
||||
service_dicts.append(service_dict)
|
||||
|
||||
if live_query:
|
||||
service_dicts = query_filter.filter_dict_list_with_live_query(
|
||||
service_dicts,
|
||||
live_query
|
||||
)
|
||||
if live_query:
|
||||
service_dicts = query_filter.filter_dict_list_with_live_query(
|
||||
service_dicts,
|
||||
live_query
|
||||
)
|
||||
|
||||
services = []
|
||||
for service_dict in service_dicts:
|
||||
|
@ -23,20 +23,56 @@ class TestStatusServices(functionalTest.FunctionalTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestStatusServices, self).setUp()
|
||||
self.influxdb_response = (
|
||||
'{"results":[{"series":[{"name":"SERVICE_STATE","tags":{"host_nam'
|
||||
'e":"test_keystone","service_description":"Check KeyStone service'
|
||||
'."},"columns":["time","last_check","last_state_change","output",'
|
||||
'"state","state_type","acknowledged"],"values":[["2015-04-19T18:2'
|
||||
'0:34Z",1.429467634e+09,1.429467636632134e+09,"There was no suita'
|
||||
'ble authentication url for this request",3,"SOFT",0]]},{"name":"'
|
||||
'SERVICE_STATE","tags":{"host_name":"ws-arbiter","service_descrip'
|
||||
'tion":"check-ws-arbiter"},"columns":["time","last_check","last_s'
|
||||
'tate_change","output","state","state_type","acknowledged"],"valu'
|
||||
'es":[["2015-04-19T18:20:33Z",1.429467633e+09,1.429467635629833e+'
|
||||
'09,"TCP OK - 0.000 second response time on port 7760",0,"HARD",0'
|
||||
']]}]}]}'
|
||||
)
|
||||
self.influxdb_response = json.dumps({
|
||||
"results": [
|
||||
{"series": [
|
||||
{"name": "SERVICE_STATE",
|
||||
"tags": {"host_name": "test_keystone",
|
||||
"service_description":
|
||||
"Check KeyStone service."},
|
||||
"columns": [
|
||||
"time",
|
||||
"last_check",
|
||||
"last_state_change",
|
||||
"output",
|
||||
"state",
|
||||
"state_type",
|
||||
"acknowledged"
|
||||
],
|
||||
"values":[
|
||||
["2015-04-19T18:20:34Z",
|
||||
1.429467634e+09,
|
||||
1.429467636632134e+09,
|
||||
("There was no suitable "
|
||||
"authentication url for this request"),
|
||||
3,
|
||||
"SOFT",
|
||||
0]
|
||||
]},
|
||||
{"name": "SERVICE_STATE",
|
||||
"tags": {"host_name": "ws-arbiter",
|
||||
"service_description": "check-ws-arbiter"},
|
||||
"columns": [
|
||||
"time",
|
||||
"last_check",
|
||||
"last_state_change",
|
||||
"output",
|
||||
"state",
|
||||
"state_type",
|
||||
"acknowledged"
|
||||
],
|
||||
"values":[
|
||||
["2015-04-19T18:20:33Z",
|
||||
1.429467633e+09,
|
||||
1.429467635629833e+09,
|
||||
"TCP OK - 0.000 second response time on port 7760",
|
||||
0,
|
||||
"HARD",
|
||||
0]
|
||||
]}
|
||||
]}
|
||||
]
|
||||
})
|
||||
|
||||
@httpretty.activate
|
||||
def test_get_all_services(self):
|
||||
|
Loading…
Reference in New Issue
Block a user