Sha256: 9dcb45aee4fb5fb22958867a9e7d088959f88c63019a179fd1ca07de8604af42

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

#
# testing ruote
#
# Tue Oct 27 01:36:52 JST 2009
#

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


class RtWhenTest < Test::Unit::TestCase
  include FunctionalBase
  include RestartBase

  def test_once_and_restart

    do_test('1s')
  end

  def test_once_cron_and_restart

    do_test('* * * * * *')
  end

  protected

  def do_test(freq)

    start_new_engine

    pdef = Ruote.process_definition :name => 'test' do
      sequence do
        echo 'in'
        once '${v:resume}', :freq => freq
        echo 'out.'
      end
    end

    #@dashboard.noisy = true

    wfid = @dashboard.launch(pdef)

    wait_for(5)

    sleep 0.300
      # give it some time to register the schedule

    assert_equal 1, @dashboard.processes.size
    assert_equal 1, @dashboard.storage.get_many('schedules').size

    @dashboard.shutdown

    # restart...

    start_new_engine

    sleep 0.500

    #noisy

    assert_equal 1, @dashboard.processes.size
    assert_equal 1, @dashboard.storage.get_many('schedules').size

    @dashboard.variables['resume'] = true

    wait_for(wfid)

    assert_equal "in\nout.", @tracer.to_s

    assert_equal 0, @dashboard.processes.size
    assert_equal 0, @dashboard.storage.get_many('schedules').size
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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