#NEWLINE# def TestHookDisappeared( ) : #NEWLINE# #INDENT# "Checks whether the global hooks have been executed (status disappeared).\n\n  - Global pre hook should has been executed.\n  - Global post hook should with status *disappeared* should has been executed.\n  - Global post hook with other statuses shouldn't have been executed.\n  " #NEWLINE# master = GetMasterNode ( ) . primary #NEWLINE# job_id = ExecuteJobProducingCommand ( 'gnt-debug delay --submit 10' ) #NEWLINE# time . sleep ( 1 ) #NEWLINE# GetCommandOutput ( master , ( 'gnt-job cancel --kill --yes-do-it %d' % job_id ) ) #NEWLINE# time . sleep ( 10 ) #NEWLINE# AssertEqual ( IsFileExists ( master , _GetHookFilePath ( job_id , 'pre' ) ) , True , "Global pre hook hasn't been executed." ) #NEWLINE# AssertEqual ( IsFileExists ( job_id , _GetHookFilePath ( job_id , 'post' , constants . POST_HOOKS_STATUS_SUCCESS ) ) , False , 'Global post hook has been executed with status *success*' ) #NEWLINE# AssertEqual ( IsFileExists ( master , _GetHookFilePath ( job_id , 'post' , constants . POST_HOOKS_STATUS_ERROR ) ) , False , 'Global post hook has been executed with status *error*' ) #NEWLINE# AssertEqual ( IsFileExists ( master , _GetHookFilePath ( job_id , 'post' , constants . POST_HOOKS_STATUS_DISAPPEARED ) ) , True , "Global post hook hasn't been executed with status *disappeared*" )