#NEWLINE# def test_events_ops( self ) : #NEWLINE# #INDENT# ( ctx , cluster ) = self . _make_sample ( ) #NEWLINE# st_name = 'some_name' #NEWLINE# st_type = 'some_type' #NEWLINE# st_info = 'some_info' #NEWLINE# step_id = self . api . cluster_provision_step_add ( ctx , cluster . id , { #NEWLINE# #INDENT# 'step_name' : st_name , #NEWLINE# 'step_type' : st_type , #NEWLINE# #UNINDENT# } ) #NEWLINE# ncluster = self . api . cluster_get ( ctx , cluster . id ) #NEWLINE# self . assertEqual ( 1 , len ( ncluster [ 'provision_progress' ] ) ) #NEWLINE# provision_step = ncluster [ 'provision_progress' ] [ 0 ] #NEWLINE# self . assertEqual ( st_name , provision_step [ 'step_name' ] ) #NEWLINE# self . assertEqual ( st_type , provision_step [ 'step_type' ] ) #NEWLINE# self . assertEqual ( cluster . id , provision_step [ 'cluster_id' ] ) #NEWLINE# self . api . cluster_event_add ( ctx , step_id , { #NEWLINE# #INDENT# 'node_group_id' : 'node_group_id' , #NEWLINE# 'instance_id' : 'instance_id' , #NEWLINE# 'instance_name' : st_name , #NEWLINE# 'event_info' : st_info , #NEWLINE# 'successful' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# events = self . _get_events ( ctx , cluster . id , step_id ) #NEWLINE# self . assertEqual ( 1 , len ( events ) ) #NEWLINE# self . assertEqual ( st_name , events [ 0 ] . instance_name ) #NEWLINE# self . assertTrue ( events [ 0 ] . successful ) #NEWLINE# self . assertEqual ( st_info , events [ 0 ] . event_info ) #NEWLINE# self . api . cluster_destroy ( ctx , cluster . id ) #NEWLINE# with testtools . ExpectedException ( exceptions . NotFoundException ) : #NEWLINE# #INDENT# self . _get_events ( ctx , cluster . id , step_id )