Skip to content

Commit

Permalink
Adding wait for pod deletion so side effects don't hang
Browse files Browse the repository at this point in the history
around
  • Loading branch information
jonathanrainer committed Jul 18, 2022
1 parent 0165b60 commit 81082a3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,6 @@ var _ = ginkgo.Describe("[efs-csi] EFS CSI", func() {
framework.ExpectNoError(err, "creating pod")
err = e2epod.WaitForPodRunningInNamespace(f.ClientSet, pod)
framework.ExpectNoError(err, "pod started running successfully")
defer func() {
_ = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), pod.Name, metav1.DeleteOptions{})
}()

provisionedPath := fmt.Sprintf("/mnt/volume1/%s/%s", basePath, dynamicPvc.Spec.VolumeName)
uid, _, err := e2evolume.PodExec(f, pod, "stat -c \"%u\" "+provisionedPath)
Expand All @@ -427,6 +424,9 @@ var _ = ginkgo.Describe("[efs-csi] EFS CSI", func() {
gid, _, err := e2evolume.PodExec(f, pod, "stat -c \"%g\" "+provisionedPath)
framework.ExpectNoError(err, "ran stat command in /mnt/volume1")
framework.ExpectEqual(gid, fmt.Sprintf("%d", 1000), "Checking GID of mounted folder")
_ = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), pod.Name, metav1.DeleteOptions{})
err = e2epod.WaitForPodToDisappear(f.ClientSet, f.Namespace.Name, pod.Name, labels.Everything(), time.Second*5, time.Second*60)
framework.ExpectNoError(err, "Cleaning up no longer required pod")
})

ginkgo.It("should delete a directory provisioned in directory provisioning mode", func() {
Expand All @@ -451,12 +451,13 @@ var _ = ginkgo.Describe("[efs-csi] EFS CSI", func() {
framework.ExpectNoError(err, "creating pod")
err = e2epod.WaitForPodRunningInNamespace(f.ClientSet, pod)
framework.ExpectNoError(err, "pod started running successfully")
defer func() {
_ = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), pod.Name, metav1.DeleteOptions{})
}()

e2evolume.VerifyExecInPodFail(f, pod, "test -f "+"/mnt/volume1/"+basePath+"/"+volumeName, 1)

_ = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), pod.Name, metav1.DeleteOptions{})
err = e2epod.WaitForPodToDisappear(f.ClientSet, f.Namespace.Name, pod.Name, labels.Everything(), time.Second*5, time.Second*60)
framework.ExpectNoError(err, "Cleaning up no longer required pod")

})
})
})
Expand Down

0 comments on commit 81082a3

Please sign in to comment.