mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
e2e: add backend image validation for rbd
validate backend rbd images count in each E2E test cases. This helps a lot to catch the issues in each test case. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
843ea1ce31
commit
d5c19954c1
150
e2e/rbd.go
150
e2e/rbd.go
@ -213,16 +213,34 @@ var _ = Describe("RBD", func() {
|
|||||||
|
|
||||||
By("create a PVC and Bind it to an app", func() {
|
By("create a PVC and Bind it to an app", func() {
|
||||||
validatePVCAndAppBinding(pvcPath, appPath, f)
|
validatePVCAndAppBinding(pvcPath, appPath, f)
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
By("create a PVC and Bind it to an app with normal user", func() {
|
By("create a PVC and Bind it to an app with normal user", func() {
|
||||||
validateNormalUserPVCAccess(pvcPath, f)
|
validateNormalUserPVCAccess(pvcPath, f)
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
By("create a PVC and Bind it to an app with ext4 as the FS ", func() {
|
By("create a PVC and Bind it to an app with ext4 as the FS ", func() {
|
||||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
createRBDStorageClass(f.ClientSet, f, nil, map[string]string{"csi.storage.k8s.io/fstype": "ext4"})
|
createRBDStorageClass(f.ClientSet, f, nil, map[string]string{"csi.storage.k8s.io/fstype": "ext4"})
|
||||||
validatePVCAndAppBinding(pvcPath, appPath, f)
|
validatePVCAndAppBinding(pvcPath, appPath, f)
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
||||||
})
|
})
|
||||||
@ -231,6 +249,12 @@ var _ = Describe("RBD", func() {
|
|||||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
createRBDStorageClass(f.ClientSet, f, nil, map[string]string{"encrypted": "true"})
|
createRBDStorageClass(f.ClientSet, f, nil, map[string]string{"encrypted": "true"})
|
||||||
validateEncryptedPVCAndAppBinding(pvcPath, appPath, "", f)
|
validateEncryptedPVCAndAppBinding(pvcPath, appPath, "", f)
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
||||||
})
|
})
|
||||||
@ -243,6 +267,12 @@ var _ = Describe("RBD", func() {
|
|||||||
}
|
}
|
||||||
createRBDStorageClass(f.ClientSet, f, nil, scOpts)
|
createRBDStorageClass(f.ClientSet, f, nil, scOpts)
|
||||||
validateEncryptedPVCAndAppBinding(pvcPath, appPath, "vault", f)
|
validateEncryptedPVCAndAppBinding(pvcPath, appPath, "vault", f)
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
||||||
})
|
})
|
||||||
@ -432,6 +462,12 @@ var _ = Describe("RBD", func() {
|
|||||||
}(&wg, i, *pvcClone, *appClone)
|
}(&wg, i, *pvcClone, *appClone)
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
// validate created backend rbd images
|
||||||
|
images = listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -587,6 +623,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
By("Resize Filesystem PVC and check application directory size", func() {
|
By("Resize Filesystem PVC and check application directory size", func() {
|
||||||
@ -612,6 +654,12 @@ var _ = Describe("RBD", func() {
|
|||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -629,6 +677,12 @@ var _ = Describe("RBD", func() {
|
|||||||
e2elog.Logf("failed to resize block PVC %v", err)
|
e2elog.Logf("failed to resize block PVC %v", err)
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -649,6 +703,12 @@ var _ = Describe("RBD", func() {
|
|||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 1 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 1)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
// delete rbd nodeplugin pods
|
// delete rbd nodeplugin pods
|
||||||
err = deletePodWithLabel("app=csi-rbdplugin", cephCSINamespace, false)
|
err = deletePodWithLabel("app=csi-rbdplugin", cephCSINamespace, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -664,6 +724,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images = listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
By("create PVC in storageClass with volumeNamePrefix", func() {
|
By("create PVC in storageClass with volumeNamePrefix", func() {
|
||||||
@ -682,6 +748,12 @@ var _ = Describe("RBD", func() {
|
|||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 1 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 1)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
// list RBD images and check if one of them has the same prefix
|
// list RBD images and check if one of them has the same prefix
|
||||||
foundIt := false
|
foundIt := false
|
||||||
for _, imgName := range listRBDImages(f) {
|
for _, imgName := range listRBDImages(f) {
|
||||||
@ -697,6 +769,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images = listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
||||||
|
|
||||||
@ -710,6 +788,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
By("validate RBD static Block PVC", func() {
|
By("validate RBD static Block PVC", func() {
|
||||||
@ -717,6 +801,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
By("validate mount options in app pod", func() {
|
By("validate mount options in app pod", func() {
|
||||||
@ -725,6 +815,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
By("creating an app with a PVC, using a topology constrained StorageClass", func() {
|
By("creating an app with a PVC, using a topology constrained StorageClass", func() {
|
||||||
@ -828,6 +924,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 1 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 1)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
// create an app and wait for 1 min for it to go to running state
|
// create an app and wait for 1 min for it to go to running state
|
||||||
err = createApp(f.ClientSet, app, 1)
|
err = createApp(f.ClientSet, app, 1)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -838,6 +940,12 @@ var _ = Describe("RBD", func() {
|
|||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validate created backend rbd images
|
||||||
|
images = listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
deleteResource(rbdExamplePath + "storageclass.yaml")
|
deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
createRBDStorageClass(f.ClientSet, f, nil, nil)
|
||||||
})
|
})
|
||||||
@ -866,7 +974,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 1 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 1)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
// delete pod as we should not create snapshot for in-use pvc
|
// delete pod as we should not create snapshot for in-use pvc
|
||||||
err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout)
|
err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -881,7 +994,14 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images = listRBDImages(f)
|
||||||
|
// parent PVC + snapshot
|
||||||
|
totalImages := 2
|
||||||
|
if len(images) != totalImages {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), totalImages)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
pvcClone, err := loadPVC(pvcClonePath)
|
pvcClone, err := loadPVC(pvcClonePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
@ -894,6 +1014,14 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
// parent pvc+ snapshot + clone
|
||||||
|
totalImages = 3
|
||||||
|
images = listRBDImages(f)
|
||||||
|
if len(images) != totalImages {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), totalImages)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
appClone, err := loadApp(appClonePath)
|
appClone, err := loadApp(appClonePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
@ -955,6 +1083,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images = listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1077,6 +1211,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images := listRBDImages(f)
|
||||||
|
if len(images) != 1 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 1)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
|
|
||||||
opt := metav1.ListOptions{
|
opt := metav1.ListOptions{
|
||||||
LabelSelector: fmt.Sprintf("app=%s", app.Name),
|
LabelSelector: fmt.Sprintf("app=%s", app.Name),
|
||||||
@ -1094,6 +1234,12 @@ var _ = Describe("RBD", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
Fail(err.Error())
|
Fail(err.Error())
|
||||||
}
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
images = listRBDImages(f)
|
||||||
|
if len(images) != 0 {
|
||||||
|
e2elog.Logf("backend image count %d expected image count %d", len(images), 0)
|
||||||
|
Fail("validate backend image failed")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Make sure this should be last testcase in this file, because
|
// Make sure this should be last testcase in this file, because
|
||||||
|
Loading…
Reference in New Issue
Block a user