#NEWLINE# @ patch . object ( Collector , 'publish' ) #NEWLINE# def test_should_work_wtih_real_data( self , publish_mock ) : #NEWLINE# #INDENT# fixture_data = self . getFixture ( 'unbound_stats' ) . getvalue ( ) #NEWLINE# collector_mock = patch . object ( UnboundCollector , 'run_command' , Mock ( return_value = [ fixture_data , '' ] ) ) #NEWLINE# collector_mock . start ( ) #NEWLINE# self . collector . collect ( ) #NEWLINE# collector_mock . stop ( ) #NEWLINE# metrics = { #NEWLINE# #INDENT# 'thread0.num.queries' : 10028 , #NEWLINE# 'thread0.num.cachehits' : 10021 , #NEWLINE# 'thread0.num.cachemiss' : 7 , #NEWLINE# 'thread0.num.prefetch' : 1 , #NEWLINE# 'thread0.num.recursivereplies' : 9 , #NEWLINE# 'thread0.requestlist.avg' : 1.25 , #NEWLINE# 'thread0.requestlist.max' : 2 , #NEWLINE# 'thread0.requestlist.overwritten' : 0 , #NEWLINE# 'thread0.requestlist.exceeded' : 0 , #NEWLINE# 'thread0.requestlist.current.all' : 1 , #NEWLINE# 'thread0.requestlist.current.user' : 1 , #NEWLINE# 'thread0.recursion.time.avg' : 9.914812 , #NEWLINE# 'thread0.recursion.time.median' : 0.08192 , #NEWLINE# 'total.num.queries' : 125609 , #NEWLINE# 'total.num.cachehits' : 125483 , #NEWLINE# 'total.num.cachemiss' : 126 , #NEWLINE# 'total.num.prefetch' : 16 , #NEWLINE# 'total.num.recursivereplies' : 136 , #NEWLINE# 'total.requestlist.avg' : 5.07746 , #NEWLINE# 'total.requestlist.max' : 10 , #NEWLINE# 'total.requestlist.overwritten' : 0 , #NEWLINE# 'total.requestlist.exceeded' : 0 , #NEWLINE# 'total.requestlist.current.all' : 23 , #NEWLINE# 'total.requestlist.current.user' : 23 , #NEWLINE# 'total.recursion.time.avg' : 13.045485 , #NEWLINE# 'total.recursion.time.median' : 0.06016 , #NEWLINE# 'time.now' : 1361926066.384873 , #NEWLINE# 'time.up' : 3006293.632453 , #NEWLINE# 'time.elapsed' : 9.981882 , #NEWLINE# 'mem.total.sbrk' : 26767360 , #NEWLINE# 'mem.cache.rrset' : 142606276 , #NEWLINE# 'mem.cache.message' : 71303005 , #NEWLINE# 'mem.mod.iterator' : 16532 , #NEWLINE# 'mem.mod.validator' : 1114579 , #NEWLINE# 'num.query.type.A' : 25596 , #NEWLINE# 'num.query.type.PTR' : 39 , #NEWLINE# 'num.query.type.MX' : 91 , #NEWLINE# 'num.query.type.AAAA' : 99883 , #NEWLINE# 'num.query.class.IN' : 125609 , #NEWLINE# 'num.query.opcode.QUERY' : 125609 , #NEWLINE# 'num.query.tcp' : 0 , #NEWLINE# 'num.query.ipv6' : 0 , #NEWLINE# 'num.query.flags.QR' : 0 , #NEWLINE# 'num.query.flags.AA' : 0 , #NEWLINE# 'num.query.flags.TC' : 0 , #NEWLINE# 'num.query.flags.RD' : 125609 , #NEWLINE# 'num.query.flags.RA' : 0 , #NEWLINE# 'num.query.flags.Z' : 0 , #NEWLINE# 'num.query.flags.AD' : 0 , #NEWLINE# 'num.query.flags.CD' : 62 , #NEWLINE# 'num.query.edns.present' : 62 , #NEWLINE# 'num.query.edns.DO' : 62 , #NEWLINE# 'num.answer.rcode.NOERROR' : 46989 , #NEWLINE# 'num.answer.rcode.SERVFAIL' : 55 , #NEWLINE# 'num.answer.rcode.NXDOMAIN' : 78575 , #NEWLINE# 'num.answer.rcode.nodata' : 20566 , #NEWLINE# 'num.answer.secure' : 0 , #NEWLINE# 'num.answer.bogus' : 0 , #NEWLINE# 'num.rrset.bogus' : 0 , #NEWLINE# 'unwanted.queries' : 0 , #NEWLINE# 'unwanted.replies' : 0 , #NEWLINE# 'histogram.16s+' : 0.0 , #NEWLINE# 'histogram.256ms+' : 3.0 , #NEWLINE# 'histogram.4s+' : 1.0 , #NEWLINE# 'histogram.2s+' : 0.0 , #NEWLINE# 'histogram.1s+' : 0.0 , #NEWLINE# 'histogram.2ms+' : 0.0 , #NEWLINE# 'histogram.1ms' : 39.0 , #NEWLINE# 'histogram.32ms+' : 18.0 , #NEWLINE# 'histogram.4ms+' : 0.0 , #NEWLINE# 'histogram.16ms+' : 10.0 , #NEWLINE# 'histogram.1ms+' : 5.0 , #NEWLINE# 'histogram.32s+' : 3.0 , #NEWLINE# 'histogram.512ms+' : 6.0 , #NEWLINE# 'histogram.128ms+' : 19.0 , #NEWLINE# 'histogram.64ms+' : 20.0 , #NEWLINE# 'histogram.8ms+' : 3.0 , #NEWLINE# 'histogram.64s+' : 9.0 , #NEWLINE# 'histogram.8s+' : 0.0 , #NEWLINE# #UNINDENT# } #NEWLINE# self . setDocExample ( collector = self . collector . __class__ . __name__ , metrics = metrics , defaultpath = metrics . collector . config [ 'path' ] ) #NEWLINE# self . assertPublishedMany ( publish_mock , metrics )