Skip to content

Commit

Permalink
add alert restore time check
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
Ben Ye committed Jul 12, 2022
1 parent 3e69541 commit 24859f5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/e2e/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,16 +658,18 @@ func TestStatelessRulerAlertStateRestore(t *testing.T) {
testutil.Ok(t, err)
if len(alerts) > 0 {
if alerts[0].State == rulespb.AlertState_FIRING {
return nil
// The second ruler alert's active at time is the same as the previous one,
// which means the alert state is restored successfully.
if alertActiveAt.Unix() == alerts[0].ActiveAt.Unix() {
return nil
} else {
return fmt.Errorf("alert active time is not restored")
}
}
}
return fmt.Errorf("alert is not firing")
})
testutil.Ok(t, err)

// The second ruler alert's active at time is the same as the previous one,
// which means the alert state is restored successfully.
testutil.Equals(t, alertActiveAt.Unix(), alerts[0].ActiveAt.Unix())
}

// TestRule_CanPersistWALData checks that in stateless mode, Thanos Ruler can persist rule evaluations
Expand Down

0 comments on commit 24859f5

Please sign in to comment.