Skip to content

Commit 958d2b3

Browse files
committed
e2e: Add testcase of invalid mount option
Added a test case to cover unmap of rbd image if the mounting fails. if we pass the invalid mount option the expectation is that mounting of rbd image to stagingpath fails. as the unmap happens it should not block the rbd pvc deletion saying rbd image is in-use. Signed-off-by: Madhu Rajanna <[email protected]> (cherry picked from commit 44da7ff)
1 parent c06533d commit 958d2b3

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

e2e/rbd.go

+34
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,40 @@ var _ = Describe("RBD", func() {
562562
createRBDStorageClass(f.ClientSet, f, nil, nil)
563563
})
564564

565+
// Mount pvc to pod with invalid mount option,expected that
566+
// mounting will fail
567+
By("Mount pvc to pod with invalid mount option", func() {
568+
deleteResource(rbdExamplePath + "storageclass.yaml")
569+
createRBDStorageClass(f.ClientSet, f, map[string]string{rbdmountOptions: "debug,invalidOption"}, nil)
570+
pvc, err := loadPVC(pvcPath)
571+
if err != nil {
572+
Fail(err.Error())
573+
}
574+
pvc.Namespace = f.UniqueName
575+
576+
app, err := loadApp(appPath)
577+
if err != nil {
578+
Fail(err.Error())
579+
}
580+
app.Namespace = f.UniqueName
581+
err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
582+
if err != nil {
583+
Fail(err.Error())
584+
}
585+
// create an app and wait for 2 min for it to go to running state
586+
err = createApp(f.ClientSet, app, 2)
587+
if err == nil {
588+
Fail("application should not go to running state due to invalid mount option")
589+
}
590+
err = deletePVCAndApp("", f, pvc, app)
591+
if err != nil {
592+
Fail(err.Error())
593+
}
594+
595+
deleteResource(rbdExamplePath + "storageclass.yaml")
596+
createRBDStorageClass(f.ClientSet, f, nil, nil)
597+
})
598+
565599
// Make sure this should be last testcase in this file, because
566600
// it deletes pool
567601
By("Create a PVC and Delete PVC when backend pool deleted", func() {

0 commit comments

Comments
 (0)