Alerting: Fix creating a new alert rule vesion when only keep_firing_for changes (#114926)
Alerting: Create alert rule vesion when keep_firing_for changes
This commit is contained in:
@@ -88,6 +88,7 @@ func (a alertRuleVersion) EqualSpec(b alertRuleVersion) bool {
|
||||
a.NoDataState == b.NoDataState &&
|
||||
a.ExecErrState == b.ExecErrState &&
|
||||
a.For == b.For &&
|
||||
a.KeepFiringFor == b.KeepFiringFor &&
|
||||
a.Annotations == b.Annotations &&
|
||||
a.Labels == b.Labels &&
|
||||
a.IsPaused == b.IsPaused &&
|
||||
|
||||
@@ -21,6 +21,7 @@ func TestAlertRuleVersion_EqualSpec(t *testing.T) {
|
||||
NoDataState: "state1",
|
||||
ExecErrState: "state2",
|
||||
For: time.Minute,
|
||||
KeepFiringFor: 2 * time.Minute,
|
||||
Annotations: `{ "test": "annotation" }`,
|
||||
Labels: `{ "test": "label" }`,
|
||||
IsPaused: true,
|
||||
@@ -119,6 +120,12 @@ func TestAlertRuleVersion_EqualSpec(t *testing.T) {
|
||||
b: func() alertRuleVersion { v := baseVersion; v.For = 2 * time.Minute; return v }(),
|
||||
expect: false,
|
||||
},
|
||||
{
|
||||
name: "different KeepFiringFor durations",
|
||||
a: baseVersion,
|
||||
b: func() alertRuleVersion { v := baseVersion; v.KeepFiringFor = 5 * time.Minute; return v }(),
|
||||
expect: false,
|
||||
},
|
||||
{
|
||||
name: "exact match including bools and other types",
|
||||
a: func() alertRuleVersion {
|
||||
|
||||
Reference in New Issue
Block a user