Skip to content

Commit

Permalink
Adding further defers to clear up the pods
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanrainer committed Jul 15, 2022
1 parent 745af0d commit 0165b60
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,16 @@ 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, stderr, err := e2evolume.PodExec(f, pod, "stat -c \"%u\" "+provisionedPath)
framework.ExpectNoError(fmt.Errorf("error from stat command '%s', %v", stderr, err), "ran stat command in /mnt/volume1")
uid, _, err := e2evolume.PodExec(f, pod, "stat -c \"%u\" "+provisionedPath)
framework.ExpectNoError(err, "ran stat command in /mnt/volume1")
framework.ExpectEqual(uid, fmt.Sprintf("%d", 1000), "Checking UID of mounted folder")
gid, stderr, err := e2evolume.PodExec(f, pod, "stat -c \"%g\" "+provisionedPath)
framework.ExpectNoError(fmt.Errorf("error from stat command '%s', %v", stderr, err), "ran stat command in /mnt/volume1")
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")
})

Expand All @@ -448,6 +451,10 @@ 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)

})
Expand Down

0 comments on commit 0165b60

Please sign in to comment.