Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networksegmentation, udn: Wait for NetworkCreated or NetworkReady condition #29381

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions test/extended/networking/network_segmentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package networking
import (
"context"
"encoding/json"
"errors"
"fmt"
"math/big"
"net"
Expand Down Expand Up @@ -676,7 +677,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
var actualConditions []metav1.Condition
Expect(json.Unmarshal([]byte(conditionsJSON), &actualConditions)).To(Succeed())

Expect(actualConditions[0].Type).To(Equal("NetworkReady"))
Expect(actualConditions[0].Type).To(SatisfyAny(Equal("NetworkReady"), Equal("NetworkCreated")))
Expect(actualConditions[0].Status).To(Equal(metav1.ConditionFalse))
Expect(actualConditions[0].Reason).To(Equal("SyncError"))
expectedMessage := fmt.Sprintf("primary network already exist in namespace %q: %q", f.Namespace.Name, primaryNadName)
Expand Down Expand Up @@ -768,8 +769,15 @@ func applyManifest(namespace, manifest string) error {
}

func waitForUserDefinedNetworkReady(namespace, name string, timeout time.Duration) error {
_, err := e2ekubectl.RunKubectl(namespace, "wait", "userdefinednetwork", name, "--for", "condition=NetworkReady=True", "--timeout", timeout.String())
return err
_, errNetReady := e2ekubectl.RunKubectl(namespace, "wait", "userdefinednetwork", name, "--for", "condition=NetworkReady=True", "--timeout", timeout.String())
netReady := errNetReady == nil
_, errNetCreated := e2ekubectl.RunKubectl(namespace, "wait", "userdefinednetwork", name, "--for", "condition=NetworkCreated=True", "--timeout", timeout.String())
netCreated := errNetCreated == nil

if netReady || netCreated {
return nil
}
return errors.Join(errNetReady, errNetCreated)
}

func newPrimaryUserDefinedNetworkManifest(oc *exutil.CLI, name string) string {
Expand Down Expand Up @@ -865,6 +873,14 @@ func assertUDNStatusReportsConsumers(udnNamesapce, udnName, expectedPodName stri
}).Match(condition); found {
break
}
if found, _ = Equal(metav1.Condition{
Type: "NetworkCreated",
Status: "False",
Reason: "SyncError",
Message: expectedMsg,
}).Match(condition); found {
break
}
}
Expect(found).To(BeTrue(), "expected condition not found in %v", conditions)
}
Expand Down