Skip to content

Commit c9004e7

Browse files
committed
e2e/storage: check result of WaitForPersistentVolumeDeleted
When deleting fails, the tests should be considered as failed, too. Ignoring the error caused a wrong return code in the CSI mock driver to go unnoticed (see kubernetes-csi/csi-test#250). The v3.1.0 release of the CSI mock driver fixes that.
1 parent f8e62e3 commit c9004e7

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

test/e2e/storage/csi_mock_volume.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ var _ = utils.SIGDescribe("CSI mock volume", func() {
188188
claim, err := cs.CoreV1().PersistentVolumeClaims(claim.Namespace).Get(context.TODO(), claim.Name, metav1.GetOptions{})
189189
if err == nil {
190190
cs.CoreV1().PersistentVolumeClaims(claim.Namespace).Delete(context.TODO(), claim.Name, metav1.DeleteOptions{})
191-
e2epv.WaitForPersistentVolumeDeleted(cs, claim.Spec.VolumeName, framework.Poll, 2*time.Minute)
191+
errs = append(errs, e2epv.WaitForPersistentVolumeDeleted(cs, claim.Spec.VolumeName, framework.Poll, 2*time.Minute))
192192
}
193193

194194
}

test/e2e/storage/pv_protection.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ var _ = utils.SIGDescribe("PV Protection", func() {
100100
ginkgo.By("Deleting the PV")
101101
err = client.CoreV1().PersistentVolumes().Delete(context.TODO(), pv.Name, *metav1.NewDeleteOptions(0))
102102
framework.ExpectNoError(err, "Error deleting PV")
103-
e2epv.WaitForPersistentVolumeDeleted(client, pv.Name, framework.Poll, e2epv.PVDeletingTimeout)
103+
err = e2epv.WaitForPersistentVolumeDeleted(client, pv.Name, framework.Poll, e2epv.PVDeletingTimeout)
104+
framework.ExpectNoError(err, "waiting for PV to be deleted")
104105
})
105106

106107
ginkgo.It("Verify that PV bound to a PVC is not removed immediately", func() {
@@ -127,6 +128,7 @@ var _ = utils.SIGDescribe("PV Protection", func() {
127128
framework.ExpectNoError(err, "Error deleting PVC")
128129

129130
ginkgo.By("Checking that the PV is automatically removed from the system because it's no longer bound to a PVC")
130-
e2epv.WaitForPersistentVolumeDeleted(client, pv.Name, framework.Poll, e2epv.PVDeletingTimeout)
131+
err = e2epv.WaitForPersistentVolumeDeleted(client, pv.Name, framework.Poll, e2epv.PVDeletingTimeout)
132+
framework.ExpectNoError(err, "waiting for PV to be deleted")
131133
})
132134
})

test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ spec:
4545
- mountPath: /registration
4646
name: registration-dir
4747
- name: mock
48-
image: quay.io/k8scsi/mock-driver:v2.1.0
48+
image: quay.io/k8scsi/mock-driver:v3.1.0
4949
args:
5050
- "--name=mock.storage.k8s.io"
5151
- "--permissive-target-path" # because of https://github.com/kubernetes/kubernetes/issues/75535

0 commit comments

Comments
 (0)