How do you folks test failure cases in unlimited-retry jobs?
For example my job has
retry_on StandardError, wait: :polynomially_longer, attempts: :unlimited
def perform(model)
# work code
rescue => error
# error handling code
raise
end
I’d like to test “error handling code”. So I make “work code” fail, enqueue the job, and call perform_enqueued_jobs
. This creates an infinite retry loop.
That’s actually surprising, I was expecting the retry to be enqueued, but not run until I call perform_enqueued_jobs
again. Wondering if maybe it’s a bug.
Do ya’ll know if it’s intentional, and do you have ways to test it?