From 3d8d2fb738a296ced41d38dae6d9ad12e7c5722d Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Thu, 18 Dec 2025 14:35:44 -0500 Subject: [PATCH] Add/RemoveSigtermProtection event matcher for SigstoreImageVerification test Signed-off-by: Qi Wang --- .../duplicated_event_patterns.go | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_event_patterns.go b/pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_event_patterns.go index 4762422d4b91..9e44a8ab16c9 100644 --- a/pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_event_patterns.go +++ b/pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_event_patterns.go @@ -505,6 +505,12 @@ func NewUniversalPathologicalEventMatchers(kubeConfig *rest.Config, finalInterva newConfigDriftMonitorStoppedTooOftenEventMatcher := newConfigDriftMonitorStoppedTooOftenEventMatcher(finalIntervals) registry.AddPathologicalEventMatcherOrDie(newConfigDriftMonitorStoppedTooOftenEventMatcher) + newAddSigtermProtectionEventMatcher := newAddSigtermProtectionEventMatcher(finalIntervals) + registry.AddPathologicalEventMatcherOrDie(newAddSigtermProtectionEventMatcher) + + newRemoveSigtermProtectionEventMatcher := newRemoveSigtermProtectionEventMatcher(finalIntervals) + registry.AddPathologicalEventMatcherOrDie(newRemoveSigtermProtectionEventMatcher) + return registry } @@ -1225,8 +1231,46 @@ func newConfigDriftMonitorStoppedTooOftenEventMatcher(finalIntervals monitorapi. delegate: &SimplePathologicalEventMatcher{ name: "ConfigDriftMonitorStoppedTooOften", messageReasonRegex: regexp.MustCompile(`^ConfigDriftMonitorStopped$`), - jira: "https://issues.redhat.com/browse/OCPBUGS-58376", + jira: "https://issues.redhat.com/browse/OCPBUGS-63307", }, allowIfWithinIntervals: configDriftMonitorStoppedIntervals, } } + +func newAddSigtermProtectionEventMatcher(finalIntervals monitorapi.Intervals) EventMatcher { + AddSigtermProtectionIntervals := finalIntervals.Filter(func(eventInterval monitorapi.Interval) bool { + return eventInterval.Source == monitorapi.SourceE2ETest && + strings.Contains(eventInterval.Locator.Keys[monitorapi.LocatorE2ETestKey], "SigstoreImageVerification") + }) + for i := range AddSigtermProtectionIntervals { + AddSigtermProtectionIntervals[i].To = AddSigtermProtectionIntervals[i].To.Add(time.Second * 30) + AddSigtermProtectionIntervals[i].From = AddSigtermProtectionIntervals[i].From.Add(time.Second * -30) + } + return &OverlapOtherIntervalsPathologicalEventMatcher{ + delegate: &SimplePathologicalEventMatcher{ + name: "AddSigtermProtection", + messageReasonRegex: regexp.MustCompile(`^AddSigtermProtection$`), + jira: "https://issues.redhat.com/browse/OCPBUGS-63307", + }, + allowIfWithinIntervals: AddSigtermProtectionIntervals, + } +} + +func newRemoveSigtermProtectionEventMatcher(finalIntervals monitorapi.Intervals) EventMatcher { + RemoveSigtermProtectionIntervals := finalIntervals.Filter(func(eventInterval monitorapi.Interval) bool { + return eventInterval.Source == monitorapi.SourceE2ETest && + strings.Contains(eventInterval.Locator.Keys[monitorapi.LocatorE2ETestKey], "SigstoreImageVerification") + }) + for i := range RemoveSigtermProtectionIntervals { + RemoveSigtermProtectionIntervals[i].To = RemoveSigtermProtectionIntervals[i].To.Add(time.Second * 30) + RemoveSigtermProtectionIntervals[i].From = RemoveSigtermProtectionIntervals[i].From.Add(time.Second * -30) + } + return &OverlapOtherIntervalsPathologicalEventMatcher{ + delegate: &SimplePathologicalEventMatcher{ + name: "RemoveSigtermProtection", + messageReasonRegex: regexp.MustCompile(`^RemoveSigtermProtection$`), + jira: "https://issues.redhat.com/browse/OCPBUGS-63307", + }, + allowIfWithinIntervals: RemoveSigtermProtectionIntervals, + } +}