Skip to content

Commit cee3f35

Browse files
committed
Add/RemoveSigtermProtection event matcher for SigstoreImageVerification test
Signed-off-by: Qi Wang <qiwan@redhat.com>
1 parent a53cb78 commit cee3f35

1 file changed

Lines changed: 46 additions & 2 deletions

File tree

pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_event_patterns.go

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,12 @@ func NewUniversalPathologicalEventMatchers(kubeConfig *rest.Config, finalInterva
505505
newConfigDriftMonitorStoppedTooOftenEventMatcher := newConfigDriftMonitorStoppedTooOftenEventMatcher(finalIntervals)
506506
registry.AddPathologicalEventMatcherOrDie(newConfigDriftMonitorStoppedTooOftenEventMatcher)
507507

508+
newAddSigtermProtectionEventMatcher := newAddSigtermProtectionEventMatcher(finalIntervals)
509+
registry.AddPathologicalEventMatcherOrDie(newAddSigtermProtectionEventMatcher)
510+
511+
newRemoveSigtermProtectionEventMatcher := newRemoveSigtermProtectionEventMatcher(finalIntervals)
512+
registry.AddPathologicalEventMatcherOrDie(newRemoveSigtermProtectionEventMatcher)
513+
508514
return registry
509515
}
510516

@@ -1217,16 +1223,54 @@ func newConfigDriftMonitorStoppedTooOftenEventMatcher(finalIntervals monitorapi.
12171223
strings.Contains(eventInterval.Locator.Keys[monitorapi.LocatorE2ETestKey], "SigstoreImageVerification")
12181224
})
12191225
for i := range configDriftMonitorStoppedIntervals {
1220-
configDriftMonitorStoppedIntervals[i].To = configDriftMonitorStoppedIntervals[i].To.Add(time.Second * -30)
1226+
configDriftMonitorStoppedIntervals[i].To = configDriftMonitorStoppedIntervals[i].To.Add(time.Second * 30)
12211227
configDriftMonitorStoppedIntervals[i].From = configDriftMonitorStoppedIntervals[i].From.Add(time.Second * -30)
12221228
}
12231229

12241230
return &OverlapOtherIntervalsPathologicalEventMatcher{
12251231
delegate: &SimplePathologicalEventMatcher{
12261232
name: "ConfigDriftMonitorStoppedTooOften",
12271233
messageReasonRegex: regexp.MustCompile(`^ConfigDriftMonitorStopped$`),
1228-
jira: "https://issues.redhat.com/browse/OCPBUGS-58376",
1234+
jira: "https://issues.redhat.com/browse/OCPBUGS-63307",
12291235
},
12301236
allowIfWithinIntervals: configDriftMonitorStoppedIntervals,
12311237
}
12321238
}
1239+
1240+
func newAddSigtermProtectionEventMatcher(finalIntervals monitorapi.Intervals) EventMatcher {
1241+
AddSigtermProtectionIntervals := finalIntervals.Filter(func(eventInterval monitorapi.Interval) bool {
1242+
return eventInterval.Source == monitorapi.SourceE2ETest &&
1243+
strings.Contains(eventInterval.Locator.Keys[monitorapi.LocatorE2ETestKey], "SigstoreImageVerification")
1244+
})
1245+
for i := range AddSigtermProtectionIntervals {
1246+
AddSigtermProtectionIntervals[i].To = AddSigtermProtectionIntervals[i].To.Add(time.Second * 30)
1247+
AddSigtermProtectionIntervals[i].From = AddSigtermProtectionIntervals[i].From.Add(time.Second * -30)
1248+
}
1249+
return &OverlapOtherIntervalsPathologicalEventMatcher{
1250+
delegate: &SimplePathologicalEventMatcher{
1251+
name: "AddSigtermProtection",
1252+
messageReasonRegex: regexp.MustCompile(`^AddSigtermProtection$`),
1253+
jira: "https://issues.redhat.com/browse/OCPBUGS-63307",
1254+
},
1255+
allowIfWithinIntervals: AddSigtermProtectionIntervals,
1256+
}
1257+
}
1258+
1259+
func newRemoveSigtermProtectionEventMatcher(finalIntervals monitorapi.Intervals) EventMatcher {
1260+
RemoveSigtermProtectionIntervals := finalIntervals.Filter(func(eventInterval monitorapi.Interval) bool {
1261+
return eventInterval.Source == monitorapi.SourceE2ETest &&
1262+
strings.Contains(eventInterval.Locator.Keys[monitorapi.LocatorE2ETestKey], "SigstoreImageVerification")
1263+
})
1264+
for i := range RemoveSigtermProtectionIntervals {
1265+
RemoveSigtermProtectionIntervals[i].To = RemoveSigtermProtectionIntervals[i].To.Add(time.Second * 30)
1266+
RemoveSigtermProtectionIntervals[i].From = RemoveSigtermProtectionIntervals[i].From.Add(time.Second * -30)
1267+
}
1268+
return &OverlapOtherIntervalsPathologicalEventMatcher{
1269+
delegate: &SimplePathologicalEventMatcher{
1270+
name: "RemoveSigtermProtection",
1271+
messageReasonRegex: regexp.MustCompile(`^RemoveSigtermProtection$`),
1272+
jira: "https://issues.redhat.com/browse/OCPBUGS-63307",
1273+
},
1274+
allowIfWithinIntervals: RemoveSigtermProtectionIntervals,
1275+
}
1276+
}

0 commit comments

Comments
 (0)