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

u2o check policy route add wait retry #2569

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 12 additions & 9 deletions test/e2e/kube-ovn/underlay/underlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package underlay

import (
"fmt"
"k8s.io/apimachinery/pkg/util/wait"
"net"
"os/exec"
"strconv"
Expand Down Expand Up @@ -713,15 +714,17 @@ func checkReachable(podName, podNamespace, sourceIP, targetIP, targetPort string

func checkPolicy(hitPolicyStr string, expectPolicyExist bool) {
policyExist := false
output, _ := exec.Command("bash", "-c", "kubectl ko nbctl lr-policy-list ovn-cluster").CombinedOutput()
outputStr := string(output)
lines := strings.Split(outputStr, "\n")
for _, line := range lines {
if strings.Contains(strings.Join(strings.Fields(line), " "), hitPolicyStr) {
policyExist = true
break
_ = wait.PollImmediate(time.Second, 10*time.Second, func() (bool, error) {
output, _ := exec.Command("bash", "-c", "kubectl ko nbctl lr-policy-list ovn-cluster").CombinedOutput()
outputStr := string(output)
lines := strings.Split(outputStr, "\n")
for _, line := range lines {
if strings.Contains(strings.Join(strings.Fields(line), " "), hitPolicyStr) {
policyExist = true
return true, nil
}
}

}
return false, nil
})
framework.ExpectEqual(policyExist, expectPolicyExist)
}