test/functional/ft_71_retries.rb in ruote-2.3.0.1 vs test/functional/ft_71_retries.rb in ruote-2.3.0.2

- old
+ new

@@ -9,17 +9,14 @@ class FtRetriesTest < Test::Unit::TestCase include FunctionalBase - class BadParticipant - include Ruote::LocalParticipant + class BadParticipant < Ruote::Participant def on_workitem fail 'badly' end - def on_cancel - end end # # :on_error => '4s: retry' @@ -29,12 +26,10 @@ pdef = Ruote.process_definition do alpha :on_error => '4s: retry' end - #@dashboard.noisy = true - wfid = @dashboard.launch(pdef) @dashboard.wait_for('fail') alpha = @dashboard.ps(wfid).expressions.last @@ -58,12 +53,10 @@ pdef = Ruote.process_definition do alpha :on_error => '4x: retry' end - #@dashboard.noisy = true - wfid = @dashboard.launch(pdef) @dashboard.wait_for('error_intercepted') assert_equal( @@ -81,12 +74,10 @@ pdef = Ruote.process_definition do alpha :on_error => '1s: retry, pass' echo 'over.' end - #@dashboard.noisy = true - wfid = @dashboard.launch(pdef) @dashboard.wait_for('terminated') actions = @dashboard.context.logger.log.collect { |m| @@ -110,12 +101,10 @@ pdef = Ruote.process_definition do alpha :on_error => '1s: retry * 3' end - #@dashboard.noisy = true - wfid = @dashboard.launch(pdef) @dashboard.wait_for('fail') alpha = @dashboard.ps(wfid).expressions.last @@ -137,8 +126,32 @@ @dashboard.wait_for('error_intercepted') assert_equal( '#<RuntimeError: badly>', @dashboard.ps(wfid).errors.first.message) + + fails = @dashboard.logger.log.select { |m| m['action'] == 'fail' } + assert_equal 3, fails.size + end + + # + # :on_error => 'retry * 2' + # + # retry twice, immediately + + def test_retry_star_two + + @dashboard.register_participant :alpha, BadParticipant + + pdef = Ruote.process_definition do + alpha :on_error => 'retry * 2' + end + + wfid = @dashboard.launch(pdef) + + @dashboard.wait_for('error_intercepted') + + fails = @dashboard.logger.log.select { |m| m['action'] == 'fail' } + assert_equal 2, fails.size end end