Sha256: 77b38c3f9769acbb209a4d626ec6afc21949f98b751b74b4497bc4da2f693c68

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

#
# testing ruote
#
# Wed Oct 28 12:51:04 JST 2009
#

require File.join(File.dirname(__FILE__), 'base')
require File.join(File.dirname(__FILE__), 'restart_base')


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

  def test_cron_restart

    start_new_engine

    pdef = Ruote.process_definition :name => 'test' do
      cron '* * * * * *' do # every second
        echo '${v:text}'
      end
    end

    @engine.variables['text'] = 'pre'

    #noisy

    wfid = @engine.launch(pdef)

    wait_for(3)

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

    @engine.shutdown

    # restart...

    start_new_engine

    #noisy

    @engine.variables['text'] = 'post'

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

    wait_for(4)

    assert_match /pre\npost/, @tracer.to_s

    @engine.cancel_process(wfid)

    msg = wait_for(wfid)

    assert_equal 'terminated', msg['action']
    assert_equal 0, @engine.processes.size
    assert_equal 0, @engine.storage.get_many('schedules').size
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-2.1.1 test/functional/rt_4_cron.rb