Sha256: c236f4528ed1383e7f76aa1c47de74a99d4a7aad6a2c1eb4b49df0c7b344aefc
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper") class TestYourOwnRefreshJob < Minitest::Test include TestHelper def setup Resque::StuckQueue.reset! Resque::StuckQueue.config[:trigger_timeout] = 1 Resque::StuckQueue.config[:heartbeat] = 1 Resque::StuckQueue.config[:abort_on_exception] = true Resque::StuckQueue.config[:refresh_job] = nil Resque::StuckQueue.redis = Redis.new Resque::StuckQueue.redis.flushall end def test_will_trigger_with_unrefreshing_custom_heartbeat_job # it will trigger because the key will be unrefreshed, hence 'old' and will always trigger. puts "#{__method__}" Resque::StuckQueue.config[:refresh_job] = proc { nil } # does not refresh global key @triggered = false Resque::StuckQueue.config[:triggered_handler] = proc { @triggered = true } start_and_stop_loops_after(3) assert @triggered, "will trigger because global key will be old" end def test_will_fail_with_bad_custom_heartbeat_job puts "#{__method__}" begin Resque::StuckQueue.config[:refresh_job] = proc { raise 'bad proc doc' } # does not refresh global key @triggered = false Resque::StuckQueue.config[:triggered_handler] = proc { @triggered = true } start_and_stop_loops_after(3) assert false, "should not succeed with bad refresh_job" rescue assert true, "will fail with bad refresh_job" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
resque_stuck_queue-0.1.1 | test/test_set_custom_refresh_job.rb |