Sha256: 86f63b693529b3f79f423e9e50ff1f3e77e74c43cdcd923ce10a35337752c456

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

#
# testing ruote
#
# Mon Oct 24 09:10:41 JST 2011
#

require File.expand_path('../base', __FILE__)


class FtOnTerminateTest < Test::Unit::TestCase
  include FunctionalBase

  def test_regenerate

    # var0 is used to determine if root variables are passed correctly
    # to the next generation of the workflow instance.

    pdef = Ruote.define :on_terminate => :regenerate do
      echo '${wfid}'
      echo '${v:var0}'
    end

    #@dashboard.noisy = true

    wfid = @dashboard.launch(pdef, {}, { 'var0' => 'x' })

    3.times { @dashboard.wait_for('regenerate') }

    assert @tracer.to_a.size >= 3
    assert_equal [ wfid, 'x' ], @tracer.to_a.uniq
    #assert_not_nil @dashboard.ps(wfid)
  end

  def test_cancel_regenerating_flow

    pdef = Ruote.define :on_terminate => :regenerate do
      echo 'a'
      wait 0.100
    end

    #@dashboard.noisy = true

    wfid = @dashboard.launch(pdef)

    2.times { @dashboard.wait_for('regenerate') }

    @dashboard.cancel(wfid)
    @dashboard.cancel(wfid)

    sleep 3.0

    assert_equal(
      2,
      @dashboard.context.logger.log.select { |m|
        m['action'] == 'regenerate'
      }.size)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruote-2.3.0.3 test/functional/ft_72_on_terminate.rb
ruote-2.3.0.2 test/functional/ft_72_on_terminate.rb
ruote-2.3.0.1 test/functional/ft_72_on_terminate.rb
ruote-2.3.0 test/functional/ft_72_on_terminate.rb