e2e: add rbd test for testing sc, secret via helm

add rbd test for validating storageclass and
secret deployment via helm.

Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
Yug 2021-06-24 15:50:25 +05:30 committed by mergify[bot]
parent d865670f97
commit 7d28896e36

View File

@ -199,9 +199,13 @@ var _ = Describe("RBD", func() {
if err != nil { if err != nil {
e2elog.Failf("failed to create configmap with error %v", err) e2elog.Failf("failed to create configmap with error %v", err)
} }
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy) // Since helm deploys storageclass, skip storageclass creation if
if err != nil { // ceph-csi is deployed via helm.
e2elog.Failf("failed to create storageclass with error %v", err) if !helmTest {
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy)
if err != nil {
e2elog.Failf("failed to create storageclass with error %v", err)
}
} }
// create rbd provisioner secret // create rbd provisioner secret
key, err := createCephUser(f, keyringRBDProvisionerUsername, rbdProvisionerCaps("", "")) key, err := createCephUser(f, keyringRBDProvisionerUsername, rbdProvisionerCaps("", ""))
@ -306,6 +310,32 @@ var _ = Describe("RBD", func() {
} }
}) })
// test only if ceph-csi is deployed via helm
if helmTest {
By("verify PVC and app binding on helm installation", func() {
err := validatePVCAndAppBinding(pvcPath, appPath, f)
if err != nil {
e2elog.Failf("failed to validate CephFS pvc and application binding with error %v", err)
}
// validate created backend rbd images
validateRBDImageCount(f, 0, defaultRBDPool)
// Deleting the storageclass and secret created by helm
err = deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil {
e2elog.Failf("failed to delete storageclass with error %v", err)
}
err = deleteResource(rbdExamplePath + "secret.yaml")
if err != nil {
e2elog.Failf("failed to delete secret with error %v", err)
}
// Re-create the RBD storageclass
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy)
if err != nil {
e2elog.Failf("failed to create storageclass with error %v", err)
}
})
}
By("create a PVC and validate owner", func() { By("create a PVC and validate owner", func() {
err := validateImageOwner(pvcPath, f) err := validateImageOwner(pvcPath, f)
if err != nil { if err != nil {