Skip to content

Commit

Permalink
wait subnet lb clear in set subnet EnableLb to false e2e (#2450)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Mar 10, 2023
1 parent 674cc29 commit 7ae8db6
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions test/e2e/kube-ovn/subnet/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework/deployment"
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
Expand Down Expand Up @@ -858,10 +859,21 @@ var _ = framework.Describe("[group:subnet]", func() {
modifiedSubnet := subnet.DeepCopy()
modifiedSubnet.Spec.EnableLb = &enbleLb
subnet = subnetClient.PatchSync(subnet, modifiedSubnet)
execCmd = "kubectl ko nbctl --format=csv --data=bare --no-heading --columns=load_balancer find logical-switch " + fmt.Sprintf("name=%s", subnetName)
output, err = exec.Command("bash", "-c", execCmd).CombinedOutput()
err = wait.PollImmediate(2*time.Second, 1*time.Minute, func() (bool, error) {
execCmd = "kubectl ko nbctl --format=csv --data=bare --no-heading --columns=load_balancer find logical-switch " + fmt.Sprintf("name=%s", subnetName)
output, err = exec.Command("bash", "-c", execCmd).CombinedOutput()
if err != nil {
return false, err
}
if strings.TrimSpace(string(output)) == "" {
return true, nil
}
return false, nil
})
if framework.IsTimeout(err) {
framework.Failf("timed out while wait lb record of subnet %s to clear ", subnet.Name)
}
framework.ExpectNoError(err)
framework.ExpectEmpty(strings.TrimSpace(string(output)))

ginkgo.By("Validating empty subnet spec enableLb field, should keep same value as args enableLb")
modifiedSubnet = subnet.DeepCopy()
Expand Down

0 comments on commit 7ae8db6

Please sign in to comment.