mirror of
https://github.com/Evolix/chexpire.git
synced 2024-04-26 05:50:50 +02:00
Do not mark a check in error when last run occured a few days ago (when run was successful)
This commit is contained in:
parent
aa97430e13
commit
9e8231d52c
|
@ -76,6 +76,7 @@ class Check < ApplicationRecord
|
|||
return false if created_at > ERROR_DELAY_DAYS.days.ago
|
||||
return false if last_run_at.nil?
|
||||
return true if last_success_at.nil?
|
||||
return false if last_run_at == last_success_at
|
||||
|
||||
last_success_at < ERROR_DELAY_DAYS.days.ago
|
||||
end
|
||||
|
|
|
@ -84,6 +84,12 @@ class CheckTest < ActiveSupport::TestCase
|
|||
refute check.in_error?
|
||||
end
|
||||
|
||||
test "in_error? when last check occured a few days ago without error" do
|
||||
check = build(:check, created_at: 3.weeks.ago,
|
||||
last_success_at: 10.days.ago, last_run_at: 10.days.ago)
|
||||
refute check.in_error?
|
||||
end
|
||||
|
||||
test "days_from_last_success without any success" do
|
||||
check = build(:check)
|
||||
assert_nil check.days_from_last_success
|
||||
|
|
Loading…
Reference in a new issue