#NEWLINE# def test_bad_workload_status( self ) : #NEWLINE# #INDENT# workloads = [ WorkloadRunSpec ( id = '1' , number_of_iterations = 2 , instrumentation = [ 'Signal Catcher' ] ) , WorkloadRunSpec ( id = '2' , number_of_iterations = 2 , instrumentation = [ 'Signal Catcher' ] ) , WorkloadRunSpec ( id = '3' , number_of_iterations = 2 , instrumentation = [ 'Signal Catcher' ] ) , WorkloadRunSpec ( id = '4' , number_of_iterations = 2 , instrumentation = [ 'Signal Catcher' ] ) , WorkloadRunSpec ( id = '5' , number_of_iterations = 2 , instrumentation = [ 'Signal Catcher' ] ) ] #NEWLINE# workloads [ 0 ] . _workload = BadWorkload ( Exception , [ 'setup' ] ) #NEWLINE# workloads [ 1 ] . _workload = BadWorkload ( Exception , [ 'run' ] ) #NEWLINE# workloads [ 2 ] . _workload = BadWorkload ( Exception , [ 'update_result' ] ) #NEWLINE# workloads [ 3 ] . _workload = BadWorkload ( Exception , [ 'teardown' ] ) #NEWLINE# workloads [ 4 ] . _workload = Mock ( ) #NEWLINE# context = Mock ( ) #NEWLINE# context . reboot_policy = RebootPolicy ( 'never' ) #NEWLINE# context . config . workload_specs = workloads #NEWLINE# runner = BySpecRunner ( Mock ( ) , context , Mock ( ) ) #NEWLINE# runner . init_queue ( context . config . workload_specs ) #NEWLINE# instrument = _instantiate ( SignalCatcher ) #NEWLINE# instrumentation . install ( instrument ) #NEWLINE# try : #NEWLINE# #INDENT# runner . run ( ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# instrumentation . uninstall ( instrument ) #NEWLINE# #UNINDENT# assert_equal ( len ( runner . completed_jobs ) , 10 ) #NEWLINE# assert_equal ( len ( runner . job_queue ) , 0 ) #NEWLINE# expected_status = [ IterationResult . FAILED , IterationResult . SKIPPED , IterationResult . FAILED , IterationResult . FAILED , IterationResult . PARTIAL , IterationResult . PARTIAL , IterationResult . NONCRITICAL , IterationResult . NONCRITICAL , IterationResult . OK , IterationResult . OK ] #NEWLINE# for i in range ( 0 , len ( runner . completed_jobs ) ) : #NEWLINE# #INDENT# assert_equal ( runner . completed_jobs [ i ] . result . status , expected_status [ i ] ) #NEWLINE# #UNINDENT# expected_signals = [ signal . RUN_START . name , signal . RUN_INIT . name , signal . WORKLOAD_SPEC_START . name , signal . ITERATION_START . name , signal . BEFORE_WORKLOAD_SETUP . name , signal . AFTER_WORKLOAD_SETUP . name , signal . ITERATION_END . name , signal . WORKLOAD_SPEC_END . name , signal . WORKLOAD_SPEC_START . name , signal . ITERATION_START . name , signal . BEFORE_WORKLOAD_SETUP . name , signal . SUCCESSFUL_WORKLOAD_SETUP . name , signal . AFTER_WORKLOAD_SETUP . name , signal . BEFORE_WORKLOAD_EXECUTION . name , signal . AFTER_WORKLOAD_EXECUTION . name , signal . BEFORE_WORKLOAD_RESULT_UPDATE . name , signal . AFTER_WORKLOAD_RESULT_UPDATE . name , signal . BEFORE_WORKLOAD_TEARDOWN . name , signal . SUCCESSFUL_WORKLOAD_TEARDOWN . name , signal . AFTER_WORKLOAD_TEARDOWN . name , signal . ITERATION_END . name , signal . ITERATION_START . name , signal . BEFORE_WORKLOAD_SETUP . name , signal . SUCCESSFUL_WORKLOAD_SETUP . name , signal . AFTER_WORKLOAD_SETUP . name , signal . BEFORE_WORKLOAD_EXECUTION . name , signal . AFTER_WORKLOAD_EXECUTION . name , signal . BEFORE_WORKLOAD_RESULT_UPDATE . name , signal . AFTER_WORKLOAD_RESULT_UPDATE . name , signal . BEFORE_WORKLOAD_TEARDOWN . name , signal . SUCCESSFUL_WORKLOAD_TEARDOWN . name , signal . AFTER_WORKLOAD_TEARDOWN . name , signal . ITERATION_END . name , signal . WORKLOAD_SPEC_END . name , signal . WORKLOAD_SPEC_START . name , signal . ITERATION_START . name , signal . BEFORE_WORKLOAD_SETUP . name , signal . SUCCESSFUL_WORKLOAD_SETUP . name , signal . AFTER_WORKLOAD_SETUP . name , signal . BEFORE_WORKLOAD_EXECUTION . name , signal . SUCCESSFUL_WORKLOAD_EXECUTION . name , signal . AFTER_WORKLOAD_EXECUTION . name , signal . BEFORE_WORKLOAD_RESULT_UPDATE . name , signal . AFTER_WORKLOAD_RESULT_UPDATE . name , signal . BEFORE_WORKLOAD_TEARDOWN . name , signal . SUCCESSFUL_WORKLOAD_TEARDOWN . name , signal . AFTER_WORKLOAD_TEARDOWN . name , signal . ITERATION_END . name , signal . ITERATION_START . name , signal . BEFORE_WORKLOAD_SETUP . name , signal . SUCCESSFUL_WORKLOAD_SETUP . name , signal . AFTER_WORKLOAD_SETUP . name , signal . BEFORE_WORKLOAD_EXECUTION . name , signal . SUCCESSFUL_WORKLOAD_EXECUTION . name , signal . AFTER_WORKLOAD_EXECUTION . name , signal . BEFORE_WORKLOAD_RESULT_UPDATE . name , signal . AFTER_WORKLOAD_RESULT_UPDATE . name , signal . BEFORE_WORKLOAD_TEARDOWN . name , signal . SUCCESSFUL_WORKLOAD_TEARDOWN . name , signal . AFTER_WORKLOAD_TEARDOWN . name , signal . ITERATION_END . name , signal . WORKLOAD_SPEC_END . name , signal . WORKLOAD_SPEC_START . name , signal . ITERATION_START . name , signal . BEFORE_WORKLOAD_SETUP . name , signal . SUCCESSFUL_WORKLOAD_SETUP . name , signal . AFTER_WORKLOAD_SETUP . name , signal . BEFORE_WORKLOAD_EXECUTION . name , signal . SUCCESSFUL_WORKLOAD_EXECUTION . name , signal . AFTER_WORKLOAD_EXECUTION . name , signal . BEFORE_WORKLOAD_RESULT_UPDATE . name , signal . SUCCESSFUL_WORKLOAD_RESULT_UPDATE . name , signal . AFTER_WORKLOAD_RESULT_UPDATE . name , signal . BEFORE_WORKLOAD_TEARDOWN . name , signal . AFTER_WORKLOAD_TEARDOWN . name , signal . ITERATION_END . name , signal . ITERATION_START . name , signal . BEFORE_WORKLOAD_SETUP . name , signal . SUCCESSFUL_WORKLOAD_SETUP . name , signal . AFTER_WORKLOAD_SETUP . name , signal . BEFORE_WORKLOAD_EXECUTION . name , signal . SUCCESSFUL_WORKLOAD_EXECUTION . name , signal . AFTER_WORKLOAD_EXECUTION . name , signal . BEFORE_WORKLOAD_RESULT_UPDATE . name , signal . SUCCESSFUL_WORKLOAD_RESULT_UPDATE . name , signal . AFTER_WORKLOAD_RESULT_UPDATE . name , signal . BEFORE_WORKLOAD_TEARDOWN . name , signal . AFTER_WORKLOAD_TEARDOWN . name , signal . ITERATION_END . name , signal . WORKLOAD_SPEC_END . name , signal . WORKLOAD_SPEC_START . name , signal . ITERATION_START . name , signal . BEFORE_WORKLOAD_SETUP . name , signal . SUCCESSFUL_WORKLOAD_SETUP . name , signal . AFTER_WORKLOAD_SETUP . name , signal . BEFORE_WORKLOAD_EXECUTION . name , signal . SUCCESSFUL_WORKLOAD_EXECUTION . name , signal . AFTER_WORKLOAD_EXECUTION . name , signal . BEFORE_WORKLOAD_RESULT_UPDATE . name , signal . SUCCESSFUL_WORKLOAD_RESULT_UPDATE . name , signal . AFTER_WORKLOAD_RESULT_UPDATE . name , signal . BEFORE_WORKLOAD_TEARDOWN . name , signal . SUCCESSFUL_WORKLOAD_TEARDOWN . name , signal . AFTER_WORKLOAD_TEARDOWN . name , signal . ITERATION_END . name , signal . ITERATION_START . name , signal . BEFORE_WORKLOAD_SETUP . name , signal . SUCCESSFUL_WORKLOAD_SETUP . name , signal . AFTER_WORKLOAD_SETUP . name , signal . BEFORE_WORKLOAD_EXECUTION . name , signal . SUCCESSFUL_WORKLOAD_EXECUTION . name , signal . AFTER_WORKLOAD_EXECUTION . name , signal . BEFORE_WORKLOAD_RESULT_UPDATE . name , signal . SUCCESSFUL_WORKLOAD_RESULT_UPDATE . name , signal . AFTER_WORKLOAD_RESULT_UPDATE . name , signal . BEFORE_WORKLOAD_TEARDOWN . name , signal . SUCCESSFUL_WORKLOAD_TEARDOWN . name , signal . AFTER_WORKLOAD_TEARDOWN . name , signal . ITERATION_END . name , signal . WORKLOAD_SPEC_END . name , signal . RUN_FIN . name , signal . BEFORE_OVERALL_RESULTS_PROCESSING . name , signal . SUCCESSFUL_OVERALL_RESULTS_PROCESSING . name , signal . AFTER_OVERALL_RESULTS_PROCESSING . name , signal . RUN_END . name ] #NEWLINE# assert_equal ( self , instrument . signals_received )