Commit 24f958d4 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #46991 from MrHohn/defer-deleteStaticIP-before-assert

Automatic merge from submit-queue (batch tested with PRs 43005, 46660, 46385, 46991, 47103) [gke-slow always fails] Defer DeleteGCEStaticIP before asserting error From https://github.com/kubernetes/kubernetes/issues/46918. I'm getting close to the root cause: During tests, CreateGCEStaticIP() in fact successfully created static IP, but the parser we wrote in test mistakenly think we failed, probably because the gcloud output format was changed recently (or not). I'm still looking into fixing that. This PR defer the delete function before asserting the error so that we can stop consistently leaking static IP in every run. /assign @krzyzacy @dchen1107 ```release-note NONE ```
parents 6ee02824 d455fad1
......@@ -556,7 +556,6 @@ var _ = framework.KubeDescribe("Services", func() {
By("creating a static load balancer IP")
staticIPName = fmt.Sprintf("e2e-external-lb-test-%s", framework.RunId)
requestedIP, err = framework.CreateGCEStaticIP(staticIPName)
Expect(err).NotTo(HaveOccurred())
defer func() {
if staticIPName != "" {
// Release GCE static IP - this is not kube-managed and will not be automatically released.
......@@ -565,6 +564,7 @@ var _ = framework.KubeDescribe("Services", func() {
}
}
}()
Expect(err).NotTo(HaveOccurred())
framework.Logf("Allocated static load balancer IP: %s", requestedIP)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment