From 5de44ac88080e81d32e4bdb4bb4fa3c14c3788fb Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Thu, 16 Mar 2017 11:52:58 -0700 Subject: [PATCH] Add more testing around #3390 --- test/test_api.rb | 9 +++++---- test/test_web.rb | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/test/test_api.rb b/test/test_api.rb index 5a055e5d..5ce2088b 100644 --- a/test/test_api.rb +++ b/test/test_api.rb @@ -308,12 +308,13 @@ class TestApi < Sidekiq::Test refute_nil Sidekiq::ScheduledSet.new.find_job(remain_id) end - it 'can find job by id in sorted sets' do + it 'can kill a scheduled job' do job_id = ApiWorker.perform_in(100, 1, 'jason') job = Sidekiq::ScheduledSet.new.find_job(job_id) - refute_nil job - assert_equal job_id, job.jid - assert_in_delta job.latency, 0.0, 0.1 + ds = Sidekiq::DeadSet.new + assert_equal 0, ds.size + refute_nil job.kill + assert_equal 1, ds.size end it 'can remove jobs when iterating over a sorted set' do diff --git a/test/test_web.rb b/test/test_web.rb index b47c6c1e..11762dea 100644 --- a/test/test_web.rb +++ b/test/test_web.rb @@ -547,6 +547,13 @@ class TestWeb < Sidekiq::Test assert_equal 'http://example.org/morgue', last_response.header['Location'] end + it 'can display a dead job' do + params = add_dead + get "/morgue/#{job_params(*params)}" + assert_equal 200, last_response.status + snapshot(page, name: 'Dead Job Page') + end + it 'can retry a dead job' do params = add_dead post "/morgue/#{job_params(*params)}", 'retry' => 'Retry'