e2e: test creation of additional groupSnaps to test minSnapLimit

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R 2024-11-22 15:31:18 +05:30 committed by mergify[bot]
parent a88f86e9a4
commit afc08c531c
4 changed files with 43 additions and 23 deletions

View File

@ -2480,7 +2480,7 @@ var _ = Describe(cephfsType, func() {
By("test volumeGroupSnapshot", func() {
scName := "csi-cephfs-sc"
snapshotter, err := newCephFSVolumeGroupSnapshot(f, f.UniqueName, scName, false, deployTimeout, 3)
snapshotter, err := newCephFSVolumeGroupSnapshot(f, f.UniqueName, scName, false, deployTimeout, 3, 0)
if err != nil {
framework.Failf("failed to create volumeGroupSnapshot Base: %v", err)
}

View File

@ -4881,7 +4881,7 @@ var _ = Describe("RBD", func() {
}
scName := "csi-rbd-sc"
snapshotter, err := newRBDVolumeGroupSnapshot(f, f.UniqueName, scName, false, deployTimeout, 3)
snapshotter, err := newRBDVolumeGroupSnapshot(f, f.UniqueName, scName, false, deployTimeout, 3, 5)
if err != nil {
framework.Failf("failed to create RBDVolumeGroupSnapshot: %v", err)
}

View File

@ -35,9 +35,10 @@ var _ VolumeGroupSnapshotter = &cephFSVolumeGroupSnapshot{}
func newCephFSVolumeGroupSnapshot(f *framework.Framework, namespace,
storageClass string,
blockPVC bool,
timeout, totalPVCCount int,
timeout, totalPVCCount, additionalVGSnapshotCount int,
) (VolumeGroupSnapshotter, error) {
base, err := newVolumeGroupSnapshotBase(f, namespace, storageClass, blockPVC, timeout, totalPVCCount)
base, err := newVolumeGroupSnapshotBase(f, namespace, storageClass, blockPVC,
timeout, totalPVCCount, additionalVGSnapshotCount)
if err != nil {
return nil, fmt.Errorf("failed to create volumeGroupSnapshotterBase: %w", err)
}
@ -144,9 +145,10 @@ var _ VolumeGroupSnapshotter = &rbdVolumeGroupSnapshot{}
func newRBDVolumeGroupSnapshot(f *framework.Framework, namespace,
storageClass string,
blockPVC bool,
timeout, totalPVCCount int,
timeout, totalPVCCount, additionalVGSnapshotCount int,
) (VolumeGroupSnapshotter, error) {
base, err := newVolumeGroupSnapshotBase(f, namespace, storageClass, blockPVC, timeout, totalPVCCount)
base, err := newVolumeGroupSnapshotBase(f, namespace, storageClass, blockPVC,
timeout, totalPVCCount, additionalVGSnapshotCount)
if err != nil {
return nil, fmt.Errorf("failed to create volumeGroupSnapshotterBase: %w", err)
}

View File

@ -82,13 +82,14 @@ type volumeGroupSnapshotterBase struct {
storageClassName string
blockPVC bool
totalPVCCount int
additionalVGSnapshotCount int
namespace string
}
func newVolumeGroupSnapshotBase(f *framework.Framework, namespace,
storageClass string,
blockPVC bool,
timeout, totalPVCCount int,
timeout, totalPVCCount, additionalVGSnapshotCount int,
) (*volumeGroupSnapshotterBase, error) {
config, err := framework.LoadConfig()
if err != nil {
@ -113,6 +114,7 @@ func newVolumeGroupSnapshotBase(f *framework.Framework, namespace,
blockPVC: blockPVC,
timeout: timeout,
totalPVCCount: totalPVCCount,
additionalVGSnapshotCount: additionalVGSnapshotCount,
}, err
}
@ -478,6 +480,22 @@ func (v *volumeGroupSnapshotterBase) testVolumeGroupSnapshot(vol VolumeGroupSnap
return fmt.Errorf("failed to create volume group snapshot: %w", err)
}
// Create and delete additional group snapshots.
for i := range v.additionalVGSnapshotCount {
newVGSName := fmt.Sprintf("%s-%d", vgsName, i)
_, err = v.CreateVolumeGroupSnapshot(newVGSName, vgscName, pvcLabels)
if err != nil {
return fmt.Errorf("failed to create volume group snapshot %q: %w", newVGSName, err)
}
}
for i := range v.additionalVGSnapshotCount {
newVGSName := fmt.Sprintf("%s-%d", vgsName, i)
err = v.DeleteVolumeGroupSnapshot(newVGSName)
if err != nil {
return fmt.Errorf("failed to delete volume group snapshot %q: %w", newVGSName, err)
}
}
clonePVCs, err := v.CreatePVCClones(volumeGroupSnapshot)
if err != nil {
return fmt.Errorf("failed to create clones: %w", err)