Skip to content

Commit

Permalink
Merge pull request #315 from openebs/shared_lv
Browse files Browse the repository at this point in the history
test: create a shared LV for use by two app pods
  • Loading branch information
dsharma-dc authored Jun 24, 2024
2 parents 0940723 + 4a1f214 commit bddedee
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 140 deletions.
36 changes: 27 additions & 9 deletions tests/provision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ var _ = Describe("[lvmpv] TEST VOLUME PROVISIONING", func() {
})
})

func deleteAppAndPvc(appname string, pvcname string) {
By("Deleting the application deployment")
deleteAppDeployment(appName)
func deleteAppAndPvc(appnames []string, pvcname string) {
for _, appName := range appnames {
By("Deleting the application deployment " + appName)
deleteAppDeployment(appName)
}
By("Deleting the PVC")
deleteAndVerifyPVC(pvcName)
}
Expand All @@ -56,7 +58,7 @@ func fsVolCreationTest() {
resizeAndVerifyPVC(false, "10Gi")
}

deleteAppAndPvc(appName, pvcName)
deleteAppAndPvc(appNames, pvcName)

// PV should be present after PVC deletion since snapshot is present
By("Verifying that PV exists after PVC deletion")
Expand All @@ -81,7 +83,7 @@ func blockVolCreationTest() {
createSnapshot(pvcName, snapName, snapYAML)
By("verify snapshot")
verifySnapshotCreated(snapName)
deleteAppAndPvc(appName, pvcName)
deleteAppAndPvc(appNames, pvcName)
By("Verifying that PV exists after PVC deletion")
verifyPVForPVC(true, pvcName)
By("Deleting snapshot")
Expand All @@ -91,6 +93,21 @@ func blockVolCreationTest() {
By("Deleting storage class", deleteStorageClass)
}

func sharedVolumeTest() {
By("Creating shared LV storage class", createSharedVolStorageClass)
By("creating and verifying PVC bound status", createAndVerifyPVC)
//we use two fio app pods for this test.
appNames = append(appNames, "fio-ci-1")
By("Creating and deploying app pod", createDeployVerifyApp)
By("verifying LVMVolume object", VerifyLVMVolume)
By("Online resizing the shared volume")
resizeAndVerifyPVC(true, "8Gi")
deleteAppAndPvc(appNames, pvcName)
By("Deleting storage class", deleteStorageClass)
// Reset the app list back to original
appNames = appNames[:len(appNames)-1]
}

func thinVolCreationTest() {
By("Creating thinProvision storage class", createThinStorageClass)
By("creating and verifying PVC bound status", createAndVerifyPVC)
Expand All @@ -102,7 +119,7 @@ func thinVolCreationTest() {
createSnapshot(pvcName, snapName, snapYAML)
By("verify snapshot")
verifySnapshotCreated(snapName)
deleteAppAndPvc(appName, pvcName)
deleteAppAndPvc(appNames, pvcName)
By("Verifying that PV exists after PVC deletion")
verifyPVForPVC(true, pvcName)
By("Deleting snapshot")
Expand All @@ -119,7 +136,7 @@ func thinVolCapacityTest() {
By("Creating and deploying app pod", createDeployVerifyApp)
By("verifying thinpool auto-extended", VerifyThinpoolExtend)
By("verifying LVMVolume object", VerifyLVMVolume)
deleteAppAndPvc(appName, pvcName)
deleteAppAndPvc(appNames, pvcName)
By("Deleting thinProvision storage class", deleteStorageClass)
}

Expand All @@ -130,7 +147,7 @@ func sizedSnapFSTest() {
By("verifying LVMVolume object", VerifyLVMVolume)
createSnapshot(pvcName, snapName, sizedsnapYAML)
verifySnapshotCreated(snapName)
deleteAppAndPvc(appName, pvcName)
deleteAppAndPvc(appNames, pvcName)
deleteSnapshot(pvcName, snapName, sizedsnapYAML)
By("Deleting storage class", deleteStorageClass)
}
Expand All @@ -142,7 +159,7 @@ func sizedSnapBlockTest() {
By("verifying LVMVolume object", VerifyLVMVolume)
createSnapshot(pvcName, snapName, sizedsnapYAML)
verifySnapshotCreated(snapName)
deleteAppAndPvc(appName, pvcName)
deleteAppAndPvc(appNames, pvcName)
deleteSnapshot(pvcName, snapName, sizedsnapYAML)
By("Deleting storage class", deleteStorageClass)
}
Expand Down Expand Up @@ -178,6 +195,7 @@ func volumeCreationTest() {
By("Running block volume creation test", blockVolCreationTest)
By("Running thin volume creation test", thinVolCreationTest)
By("Running leak protection test", leakProtectionTest)
By("Running shared volume for two app pods on same node test", sharedVolumeTest)
}

func capacityTest() {
Expand Down
3 changes: 2 additions & 1 deletion tests/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ var (
LocalProvisioner = "local.csi.openebs.io"
pvcName = "lvmpv-pvc"
snapName = "lvmpv-snap"
appName = "fio-ci"
// default one fio app for most tests.
appNames = []string{"fio-ci-0"}

nodeDaemonSet = "openebs-lvm-node"
controllerDeployment = "openebs-lvm-controller"
Expand Down
Loading

0 comments on commit bddedee

Please sign in to comment.