Retry node pool deletion in autoscaling tests.

This will deflake autoscaling e2e tests on gke. When there is already an operation running on the cluster, the node pool deletion will fail. This will in turn make other tests that add extra node pool fail.
pull/8/head
Beata Skiba 2018-03-30 13:26:22 +02:00
parent e57af2b354
commit b0f44e3bee
1 changed files with 12 additions and 5 deletions

View File

@ -1304,11 +1304,18 @@ func deleteNodePool(name string) {
glog.Infof("Deleting node pool %s", name) glog.Infof("Deleting node pool %s", name)
args := []string{"container", "node-pools", "delete", name, "--quiet", args := []string{"container", "node-pools", "delete", name, "--quiet",
"--cluster=" + framework.TestContext.CloudConfig.Cluster} "--cluster=" + framework.TestContext.CloudConfig.Cluster}
output, err := execCmd(getGcloudCommand(args)...).CombinedOutput() err := wait.ExponentialBackoff(
if err != nil { wait.Backoff{Duration: 1 * time.Minute, Factor: float64(3), Steps: 3},
glog.Infof("Error: %v", err) func() (bool, error) {
} output, err := execCmd(getGcloudCommand(args)...).CombinedOutput()
glog.Infof("Node-pool deletion output: %s", output) if err != nil {
glog.Warningf("Error deleting nodegroup - error:%v, output: %s", err, output)
return false, nil
}
glog.Infof("Node-pool deletion output: %s", output)
return true, nil
})
framework.ExpectNoError(err)
} }
func getPoolNodes(f *framework.Framework, poolName string) []*v1.Node { func getPoolNodes(f *framework.Framework, poolName string) []*v1.Node {