Skip to content

Commit

Permalink
Add test: infinite recursion/circular error causes
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenk committed Apr 8, 2015
1 parent eb21152 commit 60b7c95
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/test_retry.rb
Expand Up @@ -328,6 +328,30 @@ def @redis.multi; yield self; end
File.read(@tmp_log_path), 'Log entry missing for sidekiq_retry_in')
end
end

describe 'handles errors with circular causes' do
before do
@error = nil
begin
begin
raise ::StandardError, 'Error 1'
rescue ::StandardError => e1
begin
raise ::StandardError, 'Error 2'
rescue ::StandardError => e2
raise e1
end
end
rescue ::StandardError => e
@error = e
end
end

it "does not recurse infinitely checking if it's a shudtown" do
assert(!Sidekiq::Middleware::Server::RetryJobs.new.send(
:exception_caused_by_shutdown?, @error))
end
end
end

end

0 comments on commit 60b7c95

Please sign in to comment.