Skip to content

Commit be4d8f1

Browse files
committed
Fix NetworkNotReady pathological event regex case mismatch
The NetworkNotReady allowlist regex used "No CNI configuration file" (capital N) but ocicni produces "no CNI configuration file" (lowercase n). This case mismatch meant the allowlist never actually matched any event during upgrade jobs, causing intermittent test failures when the event count exceeded the threshold of 20. Change the regex to match both cases with [Nn]o and add unit tests that verify both the lowercase (real ocicni error) and uppercase variants are correctly allowed. Signed-off-by: Igal Tsoiref <itsoiref@redhat.com> Made-with: Cursor
1 parent ae654cc commit be4d8f1

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_event_patterns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ func NewUpgradePathologicalEventMatchers(kubeConfig *rest.Config, finalIntervals
615615
registry.AddPathologicalEventMatcherOrDie(&SimplePathologicalEventMatcher{
616616
name: "NetworkNotReady",
617617
messageReasonRegex: regexp.MustCompile(`^NetworkNotReady$`),
618-
messageHumanRegex: regexp.MustCompile(`network is not ready: container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: No CNI configuration file.*Has your network provider started\?`),
618+
messageHumanRegex: regexp.MustCompile(`network is not ready: container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: [Nn]o CNI configuration file.*Has your network provider started\?`),
619619
})
620620

621621
// Allow FailedScheduling repeat events during node upgrades:

pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_events_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,32 @@ func TestAllowedRepeatedEvents(t *testing.T) {
223223
Reason("SuccessfulCreate").Build(),
224224
expectedAllowName: "PacemakerStatusCollectorCronJobEvents",
225225
},
226+
{
227+
name: "NetworkNotReady with lowercase no from ocicni",
228+
locator: monitorapi.Locator{
229+
Keys: map[monitorapi.LocatorKey]string{
230+
monitorapi.LocatorNamespaceKey: "openshift-multus",
231+
monitorapi.LocatorPodKey: "network-metrics-daemon-4snn9",
232+
monitorapi.LocatorNodeKey: "ip-10-0-124-97.us-west-1.compute.internal",
233+
},
234+
},
235+
msg: monitorapi.NewMessage().HumanMessage("network is not ready: container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: no CNI configuration file in /etc/kubernetes/cni/net.d/. Has your network provider started?").
236+
Reason("NetworkNotReady").Build(),
237+
expectedAllowName: "NetworkNotReady",
238+
},
239+
{
240+
name: "NetworkNotReady with uppercase No",
241+
locator: monitorapi.Locator{
242+
Keys: map[monitorapi.LocatorKey]string{
243+
monitorapi.LocatorNamespaceKey: "openshift-network-diagnostics",
244+
monitorapi.LocatorPodKey: "network-check-target-pf5mx",
245+
monitorapi.LocatorNodeKey: "ip-10-0-80-8.us-west-1.compute.internal",
246+
},
247+
},
248+
msg: monitorapi.NewMessage().HumanMessage("network is not ready: container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: No CNI configuration file in /etc/kubernetes/cni/net.d/. Has your network provider started?").
249+
Reason("NetworkNotReady").Build(),
250+
expectedAllowName: "NetworkNotReady",
251+
},
226252
}
227253
for _, test := range tests {
228254
registry := NewUpgradePathologicalEventMatchers(nil, nil)

0 commit comments

Comments
 (0)