mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #29031 from saad-ali/waitForDetachOnPDTests
Automatic merge from submit-queue Make PD E2E Tests Wait for Detach to Prevent Kernel Errors Fixes https://github.com/kubernetes/kubernetes/issues/28854
This commit is contained in:
commit
51629f50b7
@ -131,6 +131,10 @@ var _ = framework.KubeDescribe("Pod Disks", func() {
|
|||||||
By("deleting host1Pod")
|
By("deleting host1Pod")
|
||||||
framework.ExpectNoError(podClient.Delete(host1Pod.Name, api.NewDeleteOptions(0)), "Failed to delete host1Pod")
|
framework.ExpectNoError(podClient.Delete(host1Pod.Name, api.NewDeleteOptions(0)), "Failed to delete host1Pod")
|
||||||
|
|
||||||
|
By("Test completed successfully, waiting for PD to safely detach")
|
||||||
|
waitForPDDetach(diskName, host0Name)
|
||||||
|
waitForPDDetach(diskName, host1Name)
|
||||||
|
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -191,6 +195,10 @@ var _ = framework.KubeDescribe("Pod Disks", func() {
|
|||||||
By("deleting host1Pod")
|
By("deleting host1Pod")
|
||||||
framework.ExpectNoError(podClient.Delete(host1Pod.Name, &api.DeleteOptions{}), "Failed to delete host1Pod")
|
framework.ExpectNoError(podClient.Delete(host1Pod.Name, &api.DeleteOptions{}), "Failed to delete host1Pod")
|
||||||
|
|
||||||
|
By("Test completed successfully, waiting for PD to safely detach")
|
||||||
|
waitForPDDetach(diskName, host0Name)
|
||||||
|
waitForPDDetach(diskName, host1Name)
|
||||||
|
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -240,6 +248,10 @@ var _ = framework.KubeDescribe("Pod Disks", func() {
|
|||||||
|
|
||||||
By("deleting host1ROPod")
|
By("deleting host1ROPod")
|
||||||
framework.ExpectNoError(podClient.Delete(host1ROPod.Name, api.NewDeleteOptions(0)), "Failed to delete host1ROPod")
|
framework.ExpectNoError(podClient.Delete(host1ROPod.Name, api.NewDeleteOptions(0)), "Failed to delete host1ROPod")
|
||||||
|
|
||||||
|
By("Test completed successfully, waiting for PD to safely detach")
|
||||||
|
waitForPDDetach(diskName, host0Name)
|
||||||
|
waitForPDDetach(diskName, host1Name)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Should schedule a pod w/ a readonly PD on two hosts, then remove both gracefully. [Slow]", func() {
|
It("Should schedule a pod w/ a readonly PD on two hosts, then remove both gracefully. [Slow]", func() {
|
||||||
@ -288,6 +300,10 @@ var _ = framework.KubeDescribe("Pod Disks", func() {
|
|||||||
|
|
||||||
By("deleting host1ROPod")
|
By("deleting host1ROPod")
|
||||||
framework.ExpectNoError(podClient.Delete(host1ROPod.Name, &api.DeleteOptions{}), "Failed to delete host1ROPod")
|
framework.ExpectNoError(podClient.Delete(host1ROPod.Name, &api.DeleteOptions{}), "Failed to delete host1ROPod")
|
||||||
|
|
||||||
|
By("Test completed successfully, waiting for PD to safely detach")
|
||||||
|
waitForPDDetach(diskName, host0Name)
|
||||||
|
waitForPDDetach(diskName, host1Name)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should schedule a pod w/ a RW PD shared between multiple containers, write to PD, delete pod, verify contents, and repeat in rapid succession [Slow]", func() {
|
It("should schedule a pod w/ a RW PD shared between multiple containers, write to PD, delete pod, verify contents, and repeat in rapid succession [Slow]", func() {
|
||||||
@ -338,6 +354,9 @@ var _ = framework.KubeDescribe("Pod Disks", func() {
|
|||||||
By("deleting host0Pod")
|
By("deleting host0Pod")
|
||||||
framework.ExpectNoError(podClient.Delete(host0Pod.Name, api.NewDeleteOptions(0)), "Failed to delete host0Pod")
|
framework.ExpectNoError(podClient.Delete(host0Pod.Name, api.NewDeleteOptions(0)), "Failed to delete host0Pod")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
By("Test completed successfully, waiting for PD to safely detach")
|
||||||
|
waitForPDDetach(diskName, host0Name)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should schedule a pod w/two RW PDs both mounted to one container, write to PD, verify contents, delete pod, recreate pod, verify contents, and repeat in rapid succession [Slow]", func() {
|
It("should schedule a pod w/two RW PDs both mounted to one container, write to PD, verify contents, delete pod, recreate pod, verify contents, and repeat in rapid succession [Slow]", func() {
|
||||||
@ -394,6 +413,10 @@ var _ = framework.KubeDescribe("Pod Disks", func() {
|
|||||||
By("deleting host0Pod")
|
By("deleting host0Pod")
|
||||||
framework.ExpectNoError(podClient.Delete(host0Pod.Name, api.NewDeleteOptions(0)), "Failed to delete host0Pod")
|
framework.ExpectNoError(podClient.Delete(host0Pod.Name, api.NewDeleteOptions(0)), "Failed to delete host0Pod")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
By("Test completed successfully, waiting for PD to safely detach")
|
||||||
|
waitForPDDetach(disk1Name, host0Name)
|
||||||
|
waitForPDDetach(disk2Name, host0Name)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -623,6 +646,7 @@ func testPDPod(diskNames []string, targetHost string, readOnly bool, numContaine
|
|||||||
// Waits for specified PD to to detach from specified hostName
|
// Waits for specified PD to to detach from specified hostName
|
||||||
func waitForPDDetach(diskName, hostName string) error {
|
func waitForPDDetach(diskName, hostName string) error {
|
||||||
if framework.TestContext.Provider == "gce" || framework.TestContext.Provider == "gke" {
|
if framework.TestContext.Provider == "gce" || framework.TestContext.Provider == "gke" {
|
||||||
|
framework.Logf("Waiting for GCE PD %q to detach from node %q.", diskName, hostName)
|
||||||
gceCloud, err := getGCECloud()
|
gceCloud, err := getGCECloud()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -662,6 +686,7 @@ func getGCECloud() (*gcecloud.GCECloud, error) {
|
|||||||
|
|
||||||
func detachAndDeletePDs(diskName string, hosts []string) {
|
func detachAndDeletePDs(diskName string, hosts []string) {
|
||||||
for _, host := range hosts {
|
for _, host := range hosts {
|
||||||
|
framework.Logf("Detaching GCE PD %q from node %q.", diskName, host)
|
||||||
detachPD(host, diskName)
|
detachPD(host, diskName)
|
||||||
By(fmt.Sprintf("Waiting for PD %q to detach from %q", diskName, host))
|
By(fmt.Sprintf("Waiting for PD %q to detach from %q", diskName, host))
|
||||||
waitForPDDetach(diskName, host)
|
waitForPDDetach(diskName, host)
|
||||||
|
Loading…
Reference in New Issue
Block a user