#NEWLINE# @ patch . object ( Collector , 'publish' ) #NEWLINE# def test_should_work_with_real_data_logstash_mode( self , publish_mock ) : #NEWLINE# #INDENT# returns = [ self . getFixture ( 'stats' ) , self . getFixture ( 'logstash_indices_stats' ) ] #NEWLINE# urlopen_mock = patch ( 'urllib2.urlopen' , Mock ( side_effect = ( lambda * args : returns . pop ( 0 ) ) ) ) #NEWLINE# self . collector . config [ 'logstash_mode' ] = True #NEWLINE# urlopen_mock . start ( ) #NEWLINE# self . collector . collect ( ) #NEWLINE# urlopen_mock . stop ( ) #NEWLINE# self . assertEqual ( urlopen_mock . new . call_count , 2 ) #NEWLINE# metrics = { #NEWLINE# #INDENT# 'indices.docs.count' : 11968062 , #NEWLINE# 'indices.docs.deleted' : 2692068 , #NEWLINE# 'indices.datastore.size' : 22724243633 , #NEWLINE# 'indices._all.docs.count' : 35856619 , #NEWLINE# 'indices._all.docs.deleted' : 0 , #NEWLINE# 'indices._all.datastore.size' : 21903813340 , #NEWLINE# 'indices._all.get.exists_time_in_millis' : 0 , #NEWLINE# 'indices._all.get.exists_total' : 0 , #NEWLINE# 'indices._all.get.missing_time_in_millis' : 0 , #NEWLINE# 'indices._all.get.missing_total' : 0 , #NEWLINE# 'indices._all.get.time_in_millis' : 0 , #NEWLINE# 'indices._all.get.total' : 0 , #NEWLINE# 'indices._all.indexing.delete_time_in_millis' : 0 , #NEWLINE# 'indices._all.indexing.delete_total' : 0 , #NEWLINE# 'indices._all.indexing.index_time_in_millis' : 29251475 , #NEWLINE# 'indices._all.indexing.index_total' : 35189321 , #NEWLINE# 'indices._all.search.fetch_time_in_millis' : 6962 , #NEWLINE# 'indices._all.search.fetch_total' : 4084 , #NEWLINE# 'indices._all.search.query_time_in_millis' : 41211 , #NEWLINE# 'indices._all.search.query_total' : 4266 , #NEWLINE# 'indices._all.store.throttle_time_in_millis' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.indexes_in_group' : 3 , #NEWLINE# 'indices.logstash-adm-syslog.datastore.size' : 21903813340 , #NEWLINE# 'indices.logstash-adm-syslog.docs.count' : 35856619 , #NEWLINE# 'indices.logstash-adm-syslog.docs.deleted' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.get.exists_time_in_millis' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.get.exists_total' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.get.missing_time_in_millis' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.get.missing_total' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.get.time_in_millis' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.get.total' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.indexing.delete_time_in_millis' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.indexing.delete_total' : 0 , #NEWLINE# 'indices.logstash-adm-syslog.indexing.index_time_in_millis' : 29251475 , #NEWLINE# 'indices.logstash-adm-syslog.indexing.index_total' : 35189321 , #NEWLINE# 'indices.logstash-adm-syslog.search.fetch_time_in_millis' : 6962 , #NEWLINE# 'indices.logstash-adm-syslog.search.fetch_total' : 4084 , #NEWLINE# 'indices.logstash-adm-syslog.search.query_time_in_millis' : 41211 , #NEWLINE# 'indices.logstash-adm-syslog.search.query_total' : 4266 , #NEWLINE# 'indices.logstash-adm-syslog.store.throttle_time_in_millis' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# self . setDocExample ( collector = self . collector . __class__ . __name__ , metrics = metrics , defaultpath = self . collector . config [ 'path' ] ) #NEWLINE# self . assertPublishedMany ( publish_mock , metrics )