Ordered failed background jobs by number of entries which also stabilizes test.
This commit is contained in:
parent
7e9728b970
commit
12ea65f84f
2 changed files with 3 additions and 2 deletions
|
@ -96,7 +96,8 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
|
||||||
end
|
end
|
||||||
|
|
||||||
listed_failed_jobs = failed_jobs.select(:handler, :attempts).limit(10)
|
listed_failed_jobs = failed_jobs.select(:handler, :attempts).limit(10)
|
||||||
listed_failed_jobs.group_by(&:name).each_with_index do |(name, jobs), index|
|
sorted_failed_jobs = listed_failed_jobs.group_by(&:name).sort_by { |_handler, entries| entries.length }.reverse.to_h
|
||||||
|
sorted_failed_jobs.each_with_index do |(name, jobs), index|
|
||||||
|
|
||||||
attempts = jobs.map(&:attempts).sum
|
attempts = jobs.map(&:attempts).sum
|
||||||
|
|
||||||
|
|
|
@ -632,7 +632,7 @@ class MonitoringControllerTest < ActionDispatch::IntegrationTest
|
||||||
assert(result['message'])
|
assert(result['message'])
|
||||||
assert(result['issues'])
|
assert(result['issues'])
|
||||||
assert_equal(false, result['healthy'])
|
assert_equal(false, result['healthy'])
|
||||||
assert_equal("13 failing background jobs.;Failed to run background job #1 'BackgroundJobSearchIndex' 2 time(s) with 14 attempt(s).;Failed to run background job #2 'Object' 8 time(s) with 40 attempt(s).", result['message'])
|
assert_equal("13 failing background jobs.;Failed to run background job #1 'Object' 8 time(s) with 40 attempt(s).;Failed to run background job #2 'BackgroundJobSearchIndex' 2 time(s) with 14 attempt(s).", result['message'])
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
Delayed::Job.delete_all
|
Delayed::Job.delete_all
|
||||||
|
|
Loading…
Reference in a new issue