Merge pull request #5554 from betagouv/add_missing_test_on_job_retry
Add a missing test on job retry to the excon err
This commit is contained in:
commit
c4eb2ee733
1 changed files with 16 additions and 0 deletions
|
@ -13,7 +13,23 @@ RSpec.describe ApplicationJob, type: :job do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when ::Excon::Error::BadRequest is raised' do
|
||||||
|
# https://api.rubyonrails.org/classes/ActiveJob/Exceptions/ClassMethods.html#method-i-retry_on
|
||||||
|
# retry on will try 5 times and then bubble up the error
|
||||||
|
it 'makes 5 attempts' do
|
||||||
|
assert_performed_jobs 5 do
|
||||||
|
ExconErrJob.perform_later rescue ::Excon::Error::BadRequest
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class ChildJob < ApplicationJob
|
class ChildJob < ApplicationJob
|
||||||
def perform; end
|
def perform; end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class ExconErrJob < ApplicationJob
|
||||||
|
def perform
|
||||||
|
raise ::Excon::Error::BadRequest.new('bad request')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue