Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: create a shared LV for use by two app pods #315

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
dsharma-dc marked this conversation as resolved.
Show resolved Hide resolved
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
Loading