Alerting: Fix dates stored in local time when pausing alerts (#19525)
* Make tests more sensitive to timezone. * Time stamps should use UTC for consistency. * Test: Assert state is paused after pauseAllAlerts call.
This commit is contained in:
committed by
Sofia Papagiannaki
parent
82ce5a194d
commit
9904e14f8e
@@ -12,7 +12,8 @@ import (
|
||||
func mockTimeNow() {
|
||||
var timeSeed int64
|
||||
timeNow = func() time.Time {
|
||||
fakeNow := time.Unix(timeSeed, 0)
|
||||
loc := time.FixedZone("MockZoneUTC-5", -5*60*60)
|
||||
fakeNow := time.Unix(timeSeed, 0).In(loc)
|
||||
timeSeed++
|
||||
return fakeNow
|
||||
}
|
||||
@@ -84,6 +85,12 @@ func TestAlertingDataAccess(t *testing.T) {
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("alert is paused", func() {
|
||||
alert, _ = getAlertById(1)
|
||||
currentState := alert.State
|
||||
So(currentState, ShouldEqual, "paused")
|
||||
})
|
||||
|
||||
Convey("pausing alerts should update their NewStateDate", func() {
|
||||
alert, _ = getAlertById(1)
|
||||
stateDateAfterPause := alert.NewStateDate
|
||||
|
||||
Reference in New Issue
Block a user