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(ci): add missing validations in existing ci test #310

Merged
merged 1 commit into from
Jun 14, 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
25 changes: 24 additions & 1 deletion tests/provision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,46 @@ func blockVolCreationTest() {

By("Creating and deploying app pod", createDeployVerifyBlockApp)
By("verifying LVMVolume object", VerifyLVMVolume)
By("Online resizing the block volume")
resizeAndVerifyPVC(true, "8Gi")
By("create snapshot")
createSnapshot(pvcName, snapName)
By("verify snapshot")
verifySnapshotCreated(snapName)
By("Deleting application deployment")
deleteAppDeployment(appName)
By("Deleting pvc")
deleteAndVerifyPVC(pvcName)
By("Verifying that PV exists after PVC deletion")
verifyPVForPVC(true, pvcName)
By("Deleting snapshot")
deleteSnapshot(pvcName, snapName)
By("Verifying that PV is deleted after snapshot deletion")
verifyPVForPVC(false, pvcName)
By("Deleting storage class", deleteStorageClass)
}

func thinVolCreationTest() {
By("Creating thinProvision storage class", createThinStorageClass)
By("creating and verifying PVC bound status", createAndVerifyPVC)

By("Creating and deploying app pod", createDeployVerifyApp)
By("verifying LVMVolume object", VerifyLVMVolume)
By("Online resizing the block volume")
resizeAndVerifyPVC(true, "8Gi")
By("create snapshot")
createSnapshot(pvcName, snapName)
By("verify snapshot")
verifySnapshotCreated(snapName)
By("Deleting application deployment")
deleteAppDeployment(appName)
By("Deleting pvc")
deleteAndVerifyPVC(pvcName)
By("Verifying that PV exists after PVC deletion")
verifyPVForPVC(true, pvcName)
By("Deleting snapshot")
deleteSnapshot(pvcName, snapName)
By("Verifying that PV is deleted after snapshot deletion")
verifyPVForPVC(false, pvcName)
By("Deleting thinProvision storage class", deleteStorageClass)
}

Expand Down
6 changes: 6 additions & 0 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func IsPVCResizedEventually(pvcName string, newCapacity string, shouldPass bool)
Get(pvcName, metav1.GetOptions{})
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
pvcStorage := volume.Status.Capacity[corev1.ResourceName(corev1.ResourceStorage)]
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
return pvcStorage == newStorage
},
120, 5).
Expand Down Expand Up @@ -135,6 +136,7 @@ func createStorageClass() {
ginkgo.By("building a default storage class")
scObj, err = sc.NewBuilder().
WithGenerateName(scName).
WithVolumeExpansion(true).
WithParametersNew(parameters).
WithProvisioner(LocalProvisioner).Build()
gomega.Expect(err).ShouldNot(gomega.HaveOccurred(),
Expand All @@ -158,6 +160,7 @@ func createThinStorageClass() {
scObj, err = sc.NewBuilder().
WithGenerateName(scName).
WithParametersNew(parameters).
WithVolumeExpansion(true).
WithProvisioner(LocalProvisioner).Build()
gomega.Expect(err).ShouldNot(gomega.HaveOccurred(),
"while building thinProvision storageclass obj with prefix {%s}", scName)
Expand All @@ -177,9 +180,12 @@ func VerifyLVMVolume() {
gomega.Expect(vol.Spec.VolGroup).To(gomega.Equal(scObj.Parameters["volgroup"]),
"while checking volume group of lvm volume", pvcObj.Spec.VolumeName)

gomega.Expect(vol.Status.State).To(gomega.Equal("Ready"),
"While checking if lvmvolume: %s is in Ready state", pvcObj.Spec.VolumeName)
gomega.Expect(vol.Finalizers[0]).To(gomega.Equal(lvm.LVMFinalizer), "while checking finializer to be set {%s}", pvcObj.Spec.VolumeName)
}


func deleteStorageClass() {
err := SCClient.Delete(scObj.Name, &metav1.DeleteOptions{})
gomega.Expect(err).To(gomega.BeNil(),
Expand Down
Loading