mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-26 06:50:23 +00:00
e2e: test creation of additional groupSnaps to test minSnapLimit
Signed-off-by: Rakshith R <rar@redhat.com>
(cherry picked from commit afc08c531c
)
This commit is contained in:
parent
aa15e642e1
commit
5bf5f898b9
@ -2480,7 +2480,7 @@ var _ = Describe(cephfsType, func() {
|
|||||||
|
|
||||||
By("test volumeGroupSnapshot", func() {
|
By("test volumeGroupSnapshot", func() {
|
||||||
scName := "csi-cephfs-sc"
|
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 {
|
if err != nil {
|
||||||
framework.Failf("failed to create volumeGroupSnapshot Base: %v", err)
|
framework.Failf("failed to create volumeGroupSnapshot Base: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -4881,7 +4881,7 @@ var _ = Describe("RBD", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scName := "csi-rbd-sc"
|
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 {
|
if err != nil {
|
||||||
framework.Failf("failed to create RBDVolumeGroupSnapshot: %v", err)
|
framework.Failf("failed to create RBDVolumeGroupSnapshot: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,10 @@ var _ VolumeGroupSnapshotter = &cephFSVolumeGroupSnapshot{}
|
|||||||
func newCephFSVolumeGroupSnapshot(f *framework.Framework, namespace,
|
func newCephFSVolumeGroupSnapshot(f *framework.Framework, namespace,
|
||||||
storageClass string,
|
storageClass string,
|
||||||
blockPVC bool,
|
blockPVC bool,
|
||||||
timeout, totalPVCCount int,
|
timeout, totalPVCCount, additionalVGSnapshotCount int,
|
||||||
) (VolumeGroupSnapshotter, error) {
|
) (VolumeGroupSnapshotter, error) {
|
||||||
base, err := newVolumeGroupSnapshotBase(f, namespace, storageClass, blockPVC, timeout, totalPVCCount)
|
base, err := newVolumeGroupSnapshotBase(f, namespace, storageClass, blockPVC,
|
||||||
|
timeout, totalPVCCount, additionalVGSnapshotCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create volumeGroupSnapshotterBase: %w", err)
|
return nil, fmt.Errorf("failed to create volumeGroupSnapshotterBase: %w", err)
|
||||||
}
|
}
|
||||||
@ -144,9 +145,10 @@ var _ VolumeGroupSnapshotter = &rbdVolumeGroupSnapshot{}
|
|||||||
func newRBDVolumeGroupSnapshot(f *framework.Framework, namespace,
|
func newRBDVolumeGroupSnapshot(f *framework.Framework, namespace,
|
||||||
storageClass string,
|
storageClass string,
|
||||||
blockPVC bool,
|
blockPVC bool,
|
||||||
timeout, totalPVCCount int,
|
timeout, totalPVCCount, additionalVGSnapshotCount int,
|
||||||
) (VolumeGroupSnapshotter, error) {
|
) (VolumeGroupSnapshotter, error) {
|
||||||
base, err := newVolumeGroupSnapshotBase(f, namespace, storageClass, blockPVC, timeout, totalPVCCount)
|
base, err := newVolumeGroupSnapshotBase(f, namespace, storageClass, blockPVC,
|
||||||
|
timeout, totalPVCCount, additionalVGSnapshotCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create volumeGroupSnapshotterBase: %w", err)
|
return nil, fmt.Errorf("failed to create volumeGroupSnapshotterBase: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -75,20 +75,21 @@ type VolumeGroupSnapshotter interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type volumeGroupSnapshotterBase struct {
|
type volumeGroupSnapshotterBase struct {
|
||||||
timeout int
|
timeout int
|
||||||
framework *framework.Framework
|
framework *framework.Framework
|
||||||
groupclient *groupsnapclient.GroupsnapshotV1beta1Client
|
groupclient *groupsnapclient.GroupsnapshotV1beta1Client
|
||||||
snapClient *snapclient.SnapshotV1Client
|
snapClient *snapclient.SnapshotV1Client
|
||||||
storageClassName string
|
storageClassName string
|
||||||
blockPVC bool
|
blockPVC bool
|
||||||
totalPVCCount int
|
totalPVCCount int
|
||||||
namespace string
|
additionalVGSnapshotCount int
|
||||||
|
namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newVolumeGroupSnapshotBase(f *framework.Framework, namespace,
|
func newVolumeGroupSnapshotBase(f *framework.Framework, namespace,
|
||||||
storageClass string,
|
storageClass string,
|
||||||
blockPVC bool,
|
blockPVC bool,
|
||||||
timeout, totalPVCCount int,
|
timeout, totalPVCCount, additionalVGSnapshotCount int,
|
||||||
) (*volumeGroupSnapshotterBase, error) {
|
) (*volumeGroupSnapshotterBase, error) {
|
||||||
config, err := framework.LoadConfig()
|
config, err := framework.LoadConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -105,14 +106,15 @@ func newVolumeGroupSnapshotBase(f *framework.Framework, namespace,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &volumeGroupSnapshotterBase{
|
return &volumeGroupSnapshotterBase{
|
||||||
framework: f,
|
framework: f,
|
||||||
groupclient: c,
|
groupclient: c,
|
||||||
snapClient: s,
|
snapClient: s,
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
storageClassName: storageClass,
|
storageClassName: storageClass,
|
||||||
blockPVC: blockPVC,
|
blockPVC: blockPVC,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
totalPVCCount: totalPVCCount,
|
totalPVCCount: totalPVCCount,
|
||||||
|
additionalVGSnapshotCount: additionalVGSnapshotCount,
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,6 +480,22 @@ func (v *volumeGroupSnapshotterBase) testVolumeGroupSnapshot(vol VolumeGroupSnap
|
|||||||
return fmt.Errorf("failed to create volume group snapshot: %w", err)
|
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)
|
clonePVCs, err := v.CreatePVCClones(volumeGroupSnapshot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create clones: %w", err)
|
return fmt.Errorf("failed to create clones: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user