Skip to content

Commit 944a33e

Browse files
Merge pull request #30624 from QiWang19/matcher-for-AddSigtermProtection
OCPBUGS-63307: Add/RemoveSigtermProtection event matcher for SigstoreImageVerification tests
2 parents e831be6 + cee3f35 commit 944a33e

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
@@ -521,6 +521,12 @@ func NewUniversalPathologicalEventMatchers(kubeConfig *rest.Config, finalInterva
521521
newConfigDriftMonitorStoppedTooOftenEventMatcher := newConfigDriftMonitorStoppedTooOftenEventMatcher(finalIntervals)
522522
registry.AddPathologicalEventMatcherOrDie(newConfigDriftMonitorStoppedTooOftenEventMatcher)
523523

524+
newAddSigtermProtectionEventMatcher := newAddSigtermProtectionEventMatcher(finalIntervals)
525+
registry.AddPathologicalEventMatcherOrDie(newAddSigtermProtectionEventMatcher)
526+
527+
newRemoveSigtermProtectionEventMatcher := newRemoveSigtermProtectionEventMatcher(finalIntervals)
528+
registry.AddPathologicalEventMatcherOrDie(newRemoveSigtermProtectionEventMatcher)
529+
524530
return registry
525531
}
526532

@@ -1233,16 +1239,54 @@ func newConfigDriftMonitorStoppedTooOftenEventMatcher(finalIntervals monitorapi.
12331239
strings.Contains(eventInterval.Locator.Keys[monitorapi.LocatorE2ETestKey], "SigstoreImageVerification")
12341240
})
12351241
for i := range configDriftMonitorStoppedIntervals {
1236-
configDriftMonitorStoppedIntervals[i].To = configDriftMonitorStoppedIntervals[i].To.Add(time.Second * -30)
1242+
configDriftMonitorStoppedIntervals[i].To = configDriftMonitorStoppedIntervals[i].To.Add(time.Second * 30)
12371243
configDriftMonitorStoppedIntervals[i].From = configDriftMonitorStoppedIntervals[i].From.Add(time.Second * -30)
12381244
}
12391245

12401246
return &OverlapOtherIntervalsPathologicalEventMatcher{
12411247
delegate: &SimplePathologicalEventMatcher{
12421248
name: "ConfigDriftMonitorStoppedTooOften",
12431249
messageReasonRegex: regexp.MustCompile(`^ConfigDriftMonitorStopped$`),
1244-
jira: "https://issues.redhat.com/browse/OCPBUGS-58376",
1250+
jira: "https://issues.redhat.com/browse/OCPBUGS-63307",
12451251
},
12461252
allowIfWithinIntervals: configDriftMonitorStoppedIntervals,
12471253
}
12481254
}
1255+
1256+
func newAddSigtermProtectionEventMatcher(finalIntervals monitorapi.Intervals) EventMatcher {
1257+
AddSigtermProtectionIntervals := finalIntervals.Filter(func(eventInterval monitorapi.Interval) bool {
1258+
return eventInterval.Source == monitorapi.SourceE2ETest &&
1259+
strings.Contains(eventInterval.Locator.Keys[monitorapi.LocatorE2ETestKey], "SigstoreImageVerification")
1260+
})
1261+
for i := range AddSigtermProtectionIntervals {
1262+
AddSigtermProtectionIntervals[i].To = AddSigtermProtectionIntervals[i].To.Add(time.Second * 30)
1263+
AddSigtermProtectionIntervals[i].From = AddSigtermProtectionIntervals[i].From.Add(time.Second * -30)
1264+
}
1265+
return &OverlapOtherIntervalsPathologicalEventMatcher{
1266+
delegate: &SimplePathologicalEventMatcher{
1267+
name: "AddSigtermProtection",
1268+
messageReasonRegex: regexp.MustCompile(`^AddSigtermProtection$`),
1269+
jira: "https://issues.redhat.com/browse/OCPBUGS-63307",
1270+
},
1271+
allowIfWithinIntervals: AddSigtermProtectionIntervals,
1272+
}
1273+
}
1274+
1275+
func newRemoveSigtermProtectionEventMatcher(finalIntervals monitorapi.Intervals) EventMatcher {
1276+
RemoveSigtermProtectionIntervals := finalIntervals.Filter(func(eventInterval monitorapi.Interval) bool {
1277+
return eventInterval.Source == monitorapi.SourceE2ETest &&
1278+
strings.Contains(eventInterval.Locator.Keys[monitorapi.LocatorE2ETestKey], "SigstoreImageVerification")
1279+
})
1280+
for i := range RemoveSigtermProtectionIntervals {
1281+
RemoveSigtermProtectionIntervals[i].To = RemoveSigtermProtectionIntervals[i].To.Add(time.Second * 30)
1282+
RemoveSigtermProtectionIntervals[i].From = RemoveSigtermProtectionIntervals[i].From.Add(time.Second * -30)
1283+
}
1284+
return &OverlapOtherIntervalsPathologicalEventMatcher{
1285+
delegate: &SimplePathologicalEventMatcher{
1286+
name: "RemoveSigtermProtection",
1287+
messageReasonRegex: regexp.MustCompile(`^RemoveSigtermProtection$`),
1288+
jira: "https://issues.redhat.com/browse/OCPBUGS-63307",
1289+
},
1290+
allowIfWithinIntervals: RemoveSigtermProtectionIntervals,
1291+
}
1292+
}

0 commit comments

Comments
 (0)