test/functional/ft_15_timeout.rb in ruote-2.1.8 vs test/functional/ft_15_timeout.rb in ruote-2.1.9

- old
+ new

@@ -30,11 +30,11 @@ wfid = @engine.launch(pdef) wait_for(:bravo) assert_equal 0, alpha.size assert_equal 1, bravo.size - assert_equal 1, logger.log.select { |e| e['flavour'] == 'timeout' }.size + assert_equal 2, logger.log.select { |e| e['flavour'] == 'timeout' }.size assert_equal 0, @engine.storage.get_many('schedules').size assert_not_nil bravo.first.fields['__timed_out__'] end @@ -66,10 +66,20 @@ assert_equal 0, @engine.storage.get_many('schedules').size end def test_on_timeout_redo + # with ruote-couch the 'cancel-process' operation gets overriden by + # the timeout cancel... + # + # 0 20 ca * 20100320-bipopimita {} + # 1 20 ca * 20100320-bipopimita 0 {"flavour"=>nil} + # 2 20 ca * 20100320-bipopimita 0_0 {"flavour"=>"timeout"} + # 3 20 ca * 20100320-bipopimita 0_0 {"flavour"=>nil, :pi=>"0!!20100320-bipopimita"} + # + # hence the multiple cancel at the end of the test + pdef = Ruote.process_definition do alpha :timeout => '1.1', :on_timeout => 'redo' end alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new @@ -80,11 +90,14 @@ wait_for(8) #logger.log.each { |e| p e['flavour'] } assert logger.log.select { |e| e['flavour'] == 'timeout' }.size >= 2 - @engine.cancel_process(wfid) + 3.times do + Thread.pass + @engine.cancel_process(wfid) + end wait_for(wfid) assert_nil @engine.process(wfid) end @@ -193,10 +206,11 @@ #noisy wfid = @engine.launch(pdef) - wait_for(9) + #wait_for(9) + wait_for(wfid) assert_nil @engine.process(wfid) assert_equal 0, alpha.size assert_equal 0, @engine.storage.get_many('schedules').size end