Skip to content

Commit

Permalink
test: update e2e to validate snapshot class
Browse files Browse the repository at this point in the history
Signed-off-by: Santosh Pillai <sapillai@redhat.com>
  • Loading branch information
sp98 committed May 10, 2022
1 parent 79a3d9b commit b15a466
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions e2e/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"time"

. "github.com/onsi/ginkgo/v2"

snapapi "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
. "github.com/onsi/gomega"
lvmv1alpha1 "github.com/red-hat-storage/lvm-operator/api/v1alpha1"
appsv1 "k8s.io/api/apps/v1"
Expand All @@ -17,6 +19,7 @@ const (
interval = time.Second * 30
lvmVolumeGroupName = "vg1"
storageClassName = "odf-lvm-vg1"
volumeSnapshotClassName = "odf-lvm-vg1"
csiDriverName = "topolvm.cybozu.com"
topolvmNodeDaemonSetName = "topolvm-node"
topolvmCtrlDeploymentName = "topolvm-controller"
Expand Down Expand Up @@ -49,6 +52,19 @@ func validateStorageClass() error {
return nil
}

// function to validate volume snapshot class.
func ValidateVolumeSnapshotClass() error {
vsc := snapapi.VolumeSnapshotClass{}

Eventually(func() bool {
err := DeployManagerObj.GetCrClient().Get(context.TODO(), types.NamespacedName{Name: volumeSnapshotClassName}, &vsc)
return err == nil
}, timeout, interval).Should(BeTrue())

debug("VolumeSnapshotClass found\n")
return nil
}

// function to validate CSI Driver.
func validateCSIDriver() error {
cd := storagev1.CSIDriver{}
Expand Down Expand Up @@ -140,6 +156,9 @@ func ValidateResources() {
err = validateStorageClass()
Expect(err).To(BeNil())

By("Checking that the VolumeSnapshotClass has been created")
err = ValidateVolumeSnapshotClass()
Expect(err).To(BeNil())
})
})
}

0 comments on commit b15a466

Please sign in to comment.