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 5, 2022
1 parent 91d1d49 commit 783aa9f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions e2e/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"time"

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 @@ -16,6 +17,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 @@ -48,6 +50,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 @@ -141,10 +156,18 @@ func ValidateResources() error {
if err != nil {
return err
}

// Validate Storage class
err = ValidateStorageClass()
if err != nil {
return err
}

// Validate volume snapshot class
err = ValidateVolumeSnapshotClass()
if err != nil {
return err
}

return nil
}

0 comments on commit 783aa9f

Please sign in to comment.