mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Fix leaking PDs from pd.go e2e test
Also upped the timeouts, because Slow Test > Flaky Test.
This commit is contained in:
parent
841b6f6970
commit
51f1a244e7
@ -58,7 +58,7 @@ var _ = Describe("PD", func() {
|
||||
host0Pod := testPDPod(diskName, host0Name, false)
|
||||
host1Pod := testPDPod(diskName, host1Name, false)
|
||||
|
||||
By("creating PD")
|
||||
By(fmt.Sprintf("creating PD %q", diskName))
|
||||
expectNoError(createPD(diskName, testContext.gceConfig.Zone), "Error creating PD")
|
||||
|
||||
defer func() {
|
||||
@ -76,8 +76,8 @@ var _ = Describe("PD", func() {
|
||||
_, err := podClient.Create(host0Pod)
|
||||
expectNoError(err, fmt.Sprintf("Failed to create host0Pod: %v", err))
|
||||
|
||||
By("waiting up to 60 seconds for host0Pod to start running")
|
||||
expectNoError(waitForPodRunning(c, host0Pod.Name, 60*time.Second), "host0Pod not running after 60 seconds")
|
||||
By("waiting up to 180 seconds for host0Pod to start running")
|
||||
expectNoError(waitForPodRunning(c, host0Pod.Name, 180*time.Second), "host0Pod not running after 180 seconds")
|
||||
|
||||
By("deleting host0Pod")
|
||||
expectNoError(podClient.Delete(host0Pod.Name), "Failed to delete host0Pod")
|
||||
@ -86,12 +86,22 @@ var _ = Describe("PD", func() {
|
||||
_, err = podClient.Create(host1Pod)
|
||||
expectNoError(err, "Failed to create host1Pod")
|
||||
|
||||
By("waiting up to 60 seconds for host1Pod to start running")
|
||||
expectNoError(waitForPodRunning(c, host1Pod.Name, 60*time.Second), "host1Pod not running after 60 seconds")
|
||||
By("waiting up to 180 seconds for host1Pod to start running")
|
||||
expectNoError(waitForPodRunning(c, host1Pod.Name, 180*time.Second), "host1Pod not running after 180 seconds")
|
||||
|
||||
By("deleting host1Pod")
|
||||
expectNoError(podClient.Delete(host1Pod.Name), "Failed to delete host1Pod")
|
||||
|
||||
By(fmt.Sprintf("deleting PD %q", diskName))
|
||||
for start := time.Now(); time.Since(start) < 180*time.Second; time.Sleep(5 * time.Second) {
|
||||
if err = deletePD(diskName, testContext.gceConfig.Zone); err != nil {
|
||||
Logf("Couldn't delete PD. Sleeping 5 seconds")
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
expectNoError(err, "Error deleting PD")
|
||||
|
||||
return
|
||||
})
|
||||
|
||||
@ -112,13 +122,13 @@ var _ = Describe("PD", func() {
|
||||
deletePD(diskName, testContext.gceConfig.Zone)
|
||||
}()
|
||||
|
||||
By("creating PD")
|
||||
By(fmt.Sprintf("creating PD %q", diskName))
|
||||
expectNoError(createPD(diskName, testContext.gceConfig.Zone), "Error creating PD")
|
||||
|
||||
By("submitting rwPod to ensure PD is formatted")
|
||||
_, err := podClient.Create(rwPod)
|
||||
expectNoError(err, "Failed to create rwPod")
|
||||
expectNoError(waitForPodRunning(c, rwPod.Name, 60*time.Second), "rwPod not running after 60 seconds")
|
||||
expectNoError(waitForPodRunning(c, rwPod.Name, 180*time.Second), "rwPod not running after 180 seconds")
|
||||
expectNoError(podClient.Delete(rwPod.Name), "Failed to delete host0Pod")
|
||||
|
||||
By("submitting host0ROPod to kubernetes")
|
||||
@ -129,17 +139,27 @@ var _ = Describe("PD", func() {
|
||||
_, err = podClient.Create(host1ROPod)
|
||||
expectNoError(err, "Failed to create host1ROPod")
|
||||
|
||||
By("waiting up to 60 seconds for host0ROPod to start running")
|
||||
expectNoError(waitForPodRunning(c, host0ROPod.Name, 60*time.Second), "host0ROPod not running after 60 seconds")
|
||||
By("waiting up to 180 seconds for host0ROPod to start running")
|
||||
expectNoError(waitForPodRunning(c, host0ROPod.Name, 180*time.Second), "host0ROPod not running after 180 seconds")
|
||||
|
||||
By("waiting up to 60 seconds for host1ROPod to start running")
|
||||
expectNoError(waitForPodRunning(c, host1ROPod.Name, 60*time.Second), "host1ROPod not running after 60 seconds")
|
||||
By("waiting up to 180 seconds for host1ROPod to start running")
|
||||
expectNoError(waitForPodRunning(c, host1ROPod.Name, 180*time.Second), "host1ROPod not running after 180 seconds")
|
||||
|
||||
By("deleting host0ROPod")
|
||||
expectNoError(podClient.Delete(host0ROPod.Name), "Failed to delete host0ROPod")
|
||||
|
||||
By("deleting host1ROPod")
|
||||
expectNoError(podClient.Delete(host1ROPod.Name), "Failed to delete host1ROPod")
|
||||
|
||||
By(fmt.Sprintf("deleting PD %q", diskName))
|
||||
for start := time.Now(); time.Since(start) < 180*time.Second; time.Sleep(5 * time.Second) {
|
||||
if err = deletePD(diskName, testContext.gceConfig.Zone); err != nil {
|
||||
Logf("Couldn't delete PD. Sleeping 5 seconds")
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
expectNoError(err, "Error deleting PD")
|
||||
})
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user