Sha256: bed95a7593e23c0b2239a00d8967592a0337f34d7b43e5c4e3a8c2930ea61a61
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper") class TestYourOwnRefreshJob < Minitest::Test include TestHelper def setup 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.redis.flushall end def teardown Resque::StuckQueue.reset! Resque::StuckQueue.config.clear 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[: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[: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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
resque_stuck_queue-0.0.10 | test/test_set_custom_refresh_job.rb |
resque_stuck_queue-0.0.9 | test/test_set_custom_refresh_job.rb |