From 6dcc54173103e192088c99a4fbe5ae75f5216826 Mon Sep 17 00:00:00 2001 From: Jamo Luhrsen Date: Fri, 3 Apr 2026 15:20:15 -0700 Subject: [PATCH] fix CUDN status condition tests for new TransportAccepted condition upstream ovn-kubernetes commit [0] added a new TransportAccepted status condition to ClusterUserDefinedNetwork resources. two tests and a helper function assumed the condition list only contained network conditions and broke when TransportAccepted appeared. these tests are duplicates of the upstream ovn-kubernetes e2e tests which have already been fixed in the same commit. the upstream tests will run in openshift CI via the OTE binary once that framework is in production. these tests can be removed at that point, but until then this keeps them working. fixes: - validateClusterUDNStatusReportsActiveNamespacesFunc: iterate conditions to find NetworkCreated/NetworkReady instead of assuming conditions - "should report not-ready" test: use ContainElement instead of ConsistOf so extra conditions don't cause failures [0] https://github.com/ovn-org/ovn-kubernetes/commit/b8554628000db0bb9f27bf7f3f10acaa50d46d10 Signed-off-by: Jamo Luhrsen Co-Authored-By: Claude Opus 4.6 --- .../networking/network_segmentation.go | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/test/extended/networking/network_segmentation.go b/test/extended/networking/network_segmentation.go index d1daf4fbdb34..bfe46b011c03 100644 --- a/test/extended/networking/network_segmentation.go +++ b/test/extended/networking/network_segmentation.go @@ -1047,13 +1047,13 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User g.Expect(json.Unmarshal([]byte(conditionsJSON), &actualConditions)).To(Succeed()) return normalizeConditions(actualConditions) }, 5*time.Second, 1*time.Second).Should(SatisfyAny( - ConsistOf(metav1.Condition{ + ContainElement(metav1.Condition{ Type: "NetworkReady", Status: metav1.ConditionFalse, Reason: "NetworkAttachmentDefinitionSyncError", Message: expectedMessage, }), - ConsistOf(metav1.Condition{ + ContainElement(metav1.Condition{ Type: "NetworkCreated", Status: metav1.ConditionFalse, Reason: "NetworkAttachmentDefinitionSyncError", @@ -1481,23 +1481,31 @@ func validateClusterUDNStatusReportsActiveNamespacesFunc(client dynamic.Interfac return fmt.Errorf("expected at least one condition in %v", cUDN) } - c := conditions[0] - if c.Type != "NetworkCreated" && c.Type != "NetworkReady" { - return fmt.Errorf("expected NetworkCreated/NetworkReady type in %v", c) + // Find NetworkCreated/NetworkReady condition among all conditions + var networkCond *metav1.Condition + for i := range conditions { + if conditions[i].Type == "NetworkCreated" || conditions[i].Type == "NetworkReady" { + networkCond = &conditions[i] + break + } } - if c.Status != metav1.ConditionTrue { - return fmt.Errorf("expected True status in %v", c) + if networkCond == nil { + return fmt.Errorf("NetworkCreated/NetworkReady condition not found in conditions: %v", conditions) + } + + if networkCond.Status != metav1.ConditionTrue { + return fmt.Errorf("expected True status in %v", networkCond) } - if c.Reason != "NetworkAttachmentDefinitionCreated" && c.Reason != "NetworkAttachmentDefinitionReady" { - return fmt.Errorf("expected NetworkAttachmentDefinitionCreated/NetworkAttachmentDefinitionReady reason in %v", c) + if networkCond.Reason != "NetworkAttachmentDefinitionCreated" && networkCond.Reason != "NetworkAttachmentDefinitionReady" { + return fmt.Errorf("expected NetworkAttachmentDefinitionCreated/NetworkAttachmentDefinitionReady reason in %v", networkCond) } - if !strings.Contains(c.Message, "NetworkAttachmentDefinition has been created in following namespaces:") { - return fmt.Errorf("expected \"NetworkAttachmentDefinition has been created in following namespaces:\" in %s", c.Message) + if !strings.Contains(networkCond.Message, "NetworkAttachmentDefinition has been created in following namespaces:") { + return fmt.Errorf("expected \"NetworkAttachmentDefinition has been created in following namespaces:\" in %s", networkCond.Message) } for _, ns := range expectedActiveNsNames { - if !strings.Contains(c.Message, ns) { - return fmt.Errorf("expected to find %q namespace in %s", ns, c.Message) + if !strings.Contains(networkCond.Message, ns) { + return fmt.Errorf("expected to find %q namespace in %s", ns, networkCond.Message) } } return nil