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