mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
app/vmalert: fix tests after a216fe6728
a216fe6728
Signed-off-by: hagen1778 <roman@victoriametrics.com> (cherry picked from commiteed0c3c6b0
)
This commit is contained in:
parent
855c25b6c4
commit
cf541c757a
1 changed files with 21 additions and 10 deletions
|
@ -641,7 +641,7 @@ func TestGetPrometheusReqTimestamp(t *testing.T) {
|
||||||
Interval: time.Hour,
|
Interval: time.Hour,
|
||||||
},
|
},
|
||||||
"2023-08-28T11:11:00+00:00",
|
"2023-08-28T11:11:00+00:00",
|
||||||
"2023-08-28T10:59:30+00:00",
|
"2023-08-28T11:00:00+00:00",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"without query align + default evalDelay",
|
"without query align + default evalDelay",
|
||||||
|
@ -671,13 +671,22 @@ func TestGetPrometheusReqTimestamp(t *testing.T) {
|
||||||
"2023-08-28T11:30:00+00:00",
|
"2023-08-28T11:30:00+00:00",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"with eval_delay",
|
"1h interval with eval_delay",
|
||||||
&Group{
|
&Group{
|
||||||
EvalDelay: &evalDelay,
|
EvalDelay: &evalDelay,
|
||||||
Interval: time.Hour,
|
Interval: time.Hour,
|
||||||
},
|
},
|
||||||
"2023-08-28T11:41:00+00:00",
|
"2023-08-28T11:41:00+00:00",
|
||||||
"2023-08-28T10:59:00+00:00",
|
"2023-08-28T11:00:00+00:00",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"1m interval with eval_delay",
|
||||||
|
&Group{
|
||||||
|
EvalDelay: &evalDelay,
|
||||||
|
Interval: time.Minute,
|
||||||
|
},
|
||||||
|
"2023-08-28T11:41:13+00:00",
|
||||||
|
"2023-08-28T11:40:00+00:00",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"disable alignment with eval_delay",
|
"disable alignment with eval_delay",
|
||||||
|
@ -687,16 +696,18 @@ func TestGetPrometheusReqTimestamp(t *testing.T) {
|
||||||
evalAlignment: &disableAlign,
|
evalAlignment: &disableAlign,
|
||||||
},
|
},
|
||||||
"2023-08-28T11:41:00+00:00",
|
"2023-08-28T11:41:00+00:00",
|
||||||
"2023-08-28T11:40:00+00:00",
|
"2023-08-28T11:40:00+00:02",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
originT, _ := time.Parse(time.RFC3339, tc.originTS)
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
expT, _ := time.Parse(time.RFC3339, tc.expTS)
|
originT, _ := time.Parse(time.RFC3339, tc.originTS)
|
||||||
gotTS := tc.g.adjustReqTimestamp(originT)
|
expT, _ := time.Parse(time.RFC3339, tc.expTS)
|
||||||
if !gotTS.Equal(expT) {
|
gotTS := tc.g.adjustReqTimestamp(originT)
|
||||||
t.Fatalf("get wrong prometheus request timestamp, expect %s, got %s", expT, gotTS)
|
if !gotTS.Equal(expT) {
|
||||||
}
|
t.Fatalf("get wrong prometheus request timestamp, expect %s, got %s", expT, gotTS)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue