#NEWLINE# def test_metrics( self ) : #NEWLINE# #INDENT# unique = self . get_unique ( ) #NEWLINE# metric = ( 'test.dogapi.test_metric_%s' % unique ) #NEWLINE# host = ( 'test.dogapi.test_host_%s' % unique ) #NEWLINE# self . dogshell ( [ 'metric' , 'post' , '--host' , host , metric , '1' ] ) #NEWLINE# time . sleep ( 15 ) #NEWLINE# ( out , err , return_code ) = self . dogshell ( [ 'search' , 'query' , ( 'hosts:' + host ) ] ) #NEWLINE# assert ( host in out ) , ( host , out ) #NEWLINE# ( out , err , return_code ) = self . dogshell ( [ 'search' , 'query' , unique ] ) #NEWLINE# assert ( host in out ) , ( host , out ) #NEWLINE# tags0 = [ 't0' , 't1' ] #NEWLINE# self . dogshell ( ( [ 'tag' , 'add' , host ] + tags0 ) ) #NEWLINE# ( out , err , return_code ) = self . dogshell ( [ 'tag' , 'show' , host ] ) #NEWLINE# for t in tags0 : #NEWLINE# #INDENT# assert ( t in out ) , ( t , out ) #NEWLINE# #UNINDENT# tags1 = [ 't2' , 't3' ] #NEWLINE# self . dogshell ( ( [ 'tag' , 'replace' , host ] + tags1 ) ) #NEWLINE# ( out , err , return_code ) = self . dogshell ( [ 'tag' , 'show' , host ] ) #NEWLINE# for t in tags1 : #NEWLINE# #INDENT# assert ( t in out ) , ( t , out ) #NEWLINE# #UNINDENT# for t in tags0 : #NEWLINE# #INDENT# assert ( t not in out ) , ( t , out ) #NEWLINE# #UNINDENT# self . dogshell ( [ 'tag' , 'detach' , host ] ) #NEWLINE# ( out , err , return_code ) = self . dogshell ( [ 'tag' , 'show' , host ] ) #NEWLINE# self . assertEquals ( out , '' )