#NEWLINE# def test_health_event( self ) : #NEWLINE# #INDENT# dummy_tags = [ 'foo:bar' , 'elastique:recherche' ] #NEWLINE# config = { #NEWLINE# #INDENT# 'instances' : [ { #NEWLINE# #INDENT# 'url' : 'http://localhost:9200' , #NEWLINE# 'tags' : dummy_tags , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# requests . put ( 'http://localhost:9200/_settings' , data = '{"index": {"number_of_replicas": 1}}' ) #NEWLINE# self . run_check ( config ) #NEWLINE# self . assertEquals ( len ( self . events ) , 1 ) #NEWLINE# self . assertIn ( 'yellow' , self . events [ 0 ] [ 'msg_title' ] ) #NEWLINE# self . assertEquals ( ( [ 'url:http://localhost:9200' ] + dummy_tags ) , self . events [ 0 ] [ 'tags' ] ) #NEWLINE# self . assertServiceCheckWarning ( 'elasticsearch.cluster_health' , tags = [ 'host:localhost' , 'port:9200' ] , count = 1 ) #NEWLINE# requests . put ( 'http://localhost:9200/_settings' , data = '{"index": {"number_of_replicas": 0}}' ) #NEWLINE# requests . post ( 'http://localhost:9200/_flush?wait_for_ongoing' ) #NEWLINE# self . run_check ( config ) #NEWLINE# self . assertEquals ( len ( self . events ) , 1 ) #NEWLINE# self . assertIn ( 'green' , self . events [ 0 ] [ 'msg_title' ] ) #NEWLINE# self . assertEquals ( ( [ 'url:http://localhost:9200' ] + dummy_tags ) , self . events [ 0 ] [ 'tags' ] ) #NEWLINE# self . assertServiceCheckOK ( 'elasticsearch.cluster_health' , tags = [ 'host:localhost' , 'port:9200' ] , count = 1 )