fix(evaluate): a region without results no longer keeps a monitor up
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / test (pull_request) Successful in 9m3s
ci / lint (pull_request) Successful in 10m9s
ci / build (pull_request) Successful in 9m54s
ci / image (pull_request) Successful in 3m16s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / test (pull_request) Successful in 9m3s
ci / lint (pull_request) Successful in 10m9s
ci / build (pull_request) Successful in 9m54s
ci / image (pull_request) Successful in 3m16s
A monitor went down only when every assigned region had failed and reported recently, so one region whose checkers were gone kept a monitor up for good, even while all other regions reported its target failing. Regions without recent results are now left out: a monitor goes down when every region that reported recently has failed. One region failing while another succeeds still does not alert, and with every region silent nothing is judged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
4d03a86614
commit
2054660625
5 files changed
+38
-16
No files matched your search
@@ -55,9 +55,9 @@ func play(t *testing.T, e *Evaluator, now *time.Time, regions []string, confirma
|
||||
func TestDownOnlyWhenAllRegionsFail(t *testing.T) {
|
||||
e, now := newTest(t)
|
||||
play(t, e, now, []string{"eu", "us"}, 2, []step{
|
||||
{"eu", false, None},
|
||||
{"eu", false, None}, // eu confirmed down, us has not reported
|
||||
{"us", true, None},
|
||||
{"eu", false, None},
|
||||
{"eu", false, None}, // eu confirmed down, us still fine
|
||||
{"us", false, None},
|
||||
{"eu", false, None},
|
||||
{"us", false, Down}, // both regions failed twice in a row
|
||||
@@ -79,7 +79,7 @@ func TestSingleRegionWithConfirmations(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestSilentRegionBlocksAlert(t *testing.T) {
|
||||
func TestSilentRegionIsLeftOut(t *testing.T) {
|
||||
e, now := newTest(t)
|
||||
id := uuid.New()
|
||||
obs := func(region string, ok bool) Transition {
|
||||
@@ -92,12 +92,27 @@ func TestSilentRegionBlocksAlert(t *testing.T) {
|
||||
}
|
||||
return got
|
||||
}
|
||||
obs("us", false)
|
||||
// us stops reporting for longer than three intervals.
|
||||
obs("us", true)
|
||||
// us stops reporting for longer than three intervals: the failures of
|
||||
// eu alone decide.
|
||||
*now = now.Add(5 * time.Minute)
|
||||
if got := obs("eu", false); got != None {
|
||||
t.Errorf("eu failure with us silent = %v, want none", got)
|
||||
if got := obs("eu", false); got != Down {
|
||||
t.Errorf("eu failure with us silent = %v, want down", got)
|
||||
}
|
||||
// us reporting a success again brings the monitor back up.
|
||||
*now = now.Add(time.Second)
|
||||
if got := obs("us", true); got != Up {
|
||||
t.Errorf("us success after the outage = %v, want up", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReportingRegionStillVetoes(t *testing.T) {
|
||||
e, now := newTest(t)
|
||||
play(t, e, now, []string{"eu", "us"}, 1, []step{
|
||||
{"us", true, None},
|
||||
{"eu", false, None}, // us reported recently and was fine
|
||||
{"eu", false, None},
|
||||
})
|
||||
}
|
||||
|
||||
func TestOutOfOrderResultIgnored(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user