Skip to content

Commit

Permalink
wait for subnet lb (#2471)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Mar 13, 2023
1 parent 0ecd9af commit e368a20
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions test/e2e/kube-ovn/subnet/subnet.go
Expand Up @@ -891,18 +891,29 @@ var _ = framework.Describe("[group:subnet]", func() {
return false, nil
})
if framework.IsTimeout(err) {
framework.Failf("timed out while wait lb record of subnet %s to clear ", subnet.Name)
framework.Failf("timed out while wait lb record of subnet %s to clear", subnet.Name)
}
framework.ExpectNoError(err)

ginkgo.By("Validating empty subnet spec enableLb field, should keep same value as args enableLb")
modifiedSubnet = subnet.DeepCopy()
modifiedSubnet.Spec.EnableLb = nil
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 sync", subnet.Name)
}
framework.ExpectNoError(err)
framework.ExpectNotEmpty(strings.TrimSpace(string(output)))
})

framework.ConformanceIt("should support subnet add gateway event and metrics", func() {
Expand Down

0 comments on commit e368a20

Please sign in to comment.