How to test Sidekiq death handlers?

Viewed 331

How to hit Sidekiq's death_handlers from RSpec?

config/initializers/sidekiq.rb

Sidekiq.configure_server do |config|
  # ...

  config.death_handlers << lambda { |job, ex|
    throw "Retries exhausted on #{job['class']} #{job['jid']}: #{ex.inspect}."
  }
end

Tried the recommendations for ActiveJob's retry_on but no success.

Also tried within_sidekiq_retries_exhausted_block of rspec-sidekiq but that failed saying the job class doesn't have this method.

0 Answers
Related