@@ -432,73 +432,75 @@ func (v volumeGroupSnapshotterBase) DeleteVolumeGroupSnapshotClass(groupSnapshot
432432}
433433
434434func (v * volumeGroupSnapshotterBase ) testVolumeGroupSnapshot (vol VolumeGroupSnapshotter ) error {
435- pvcLabels := map [string ]string {"pvc" : "vgsc" }
436- pvcs , err := v .CreatePVCs (v .namespace , pvcLabels )
437- if err != nil {
438- return fmt .Errorf ("failed to create PVCs: %w" , err )
439- }
435+ for i := 0 ; i < 5 ; i ++ {
436+ pvcLabels := map [string ]string {"pvc" : "vgsc" }
437+ pvcs , err := v .CreatePVCs (v .namespace , pvcLabels )
438+ if err != nil {
439+ return fmt .Errorf ("failed to create PVCs: %w" , err )
440+ }
440441
441- vgsc , err := vol .GetVolumeGroupSnapshotClass ()
442- if err != nil {
443- return fmt .Errorf ("failed to get volume group snapshot class: %w" , err )
444- }
445- // Create a volume group snapshot class
446- vgscName := v .framework .Namespace .Name + "-vgsc"
447- vgsc .Name = vgscName
448- err = v .CreateVolumeGroupSnapshotClass (vgsc )
449- if err != nil {
450- return fmt .Errorf ("failed to create volume group snapshot: %w" , err )
451- }
452- vgsName := v .framework .Namespace .Name + "-vgs"
453- // Create a volume group snapshot
454- volumeGroupSnapshot , err := v .CreateVolumeGroupSnapshot (vgsName , vgscName , pvcLabels )
455- if err != nil {
456- return fmt .Errorf ("failed to create volume group snapshot: %w" , err )
457- }
442+ vgsc , err := vol .GetVolumeGroupSnapshotClass ()
443+ if err != nil {
444+ return fmt .Errorf ("failed to get volume group snapshot class: %w" , err )
445+ }
446+ // Create a volume group snapshot class
447+ vgscName := v .framework .Namespace .Name + "-vgsc"
448+ vgsc .Name = vgscName
449+ err = v .CreateVolumeGroupSnapshotClass (vgsc )
450+ if err != nil {
451+ return fmt .Errorf ("failed to create volume group snapshot: %w" , err )
452+ }
453+ vgsName := v .framework .Namespace .Name + "-vgs"
454+ // Create a volume group snapshot
455+ volumeGroupSnapshot , err := v .CreateVolumeGroupSnapshot (vgsName , vgscName , pvcLabels )
456+ if err != nil {
457+ return fmt .Errorf ("failed to create volume group snapshot: %w" , err )
458+ }
458459
459- clonePVCs , err := v .CreatePVCClones (volumeGroupSnapshot )
460- if err != nil {
461- return fmt .Errorf ("failed to create clones: %w" , err )
462- }
463- // create pods using the cloned PVCs
464- pods , err := v .CreatePods (clonePVCs )
465- if err != nil {
466- return fmt .Errorf ("failed to create pods: %w" , err )
467- }
468- // validate the resources in the backend
469- err = vol .ValidateResourcesForCreate (volumeGroupSnapshot )
470- if err != nil {
471- return fmt .Errorf ("failed to validate resources for create: %w" , err )
472- }
473- // Delete the pods
474- err = v .DeletePods (pods )
475- if err != nil {
476- return fmt .Errorf ("failed to delete pods: %w" , err )
477- }
478- // Delete the clones
479- err = v .DeletePVCs (clonePVCs )
480- if err != nil {
481- return fmt .Errorf ("failed to delete clones: %w" , err )
482- }
483- // Delete the PVCs
484- err = v .DeletePVCs (pvcs )
485- if err != nil {
486- return fmt .Errorf ("failed to delete PVCs: %w" , err )
487- }
488- // Delete the volume group snapshot
489- err = v .DeleteVolumeGroupSnapshot (volumeGroupSnapshot .Name )
490- if err != nil {
491- return fmt .Errorf ("failed to delete volume group snapshot: %w" , err )
492- }
493- // validate the resources in the backend after deleting the resources
494- err = vol .ValidateResourcesForDelete ()
495- if err != nil {
496- return fmt .Errorf ("failed to validate resources for delete: %w" , err )
497- }
498- // Delete the volume group snapshot class
499- err = v .DeleteVolumeGroupSnapshotClass (vgscName )
500- if err != nil {
501- return fmt .Errorf ("failed to delete volume group snapshot class: %w" , err )
460+ clonePVCs , err := v .CreatePVCClones (volumeGroupSnapshot )
461+ if err != nil {
462+ return fmt .Errorf ("failed to create clones: %w" , err )
463+ }
464+ // create pods using the cloned PVCs
465+ pods , err := v .CreatePods (clonePVCs )
466+ if err != nil {
467+ return fmt .Errorf ("failed to create pods: %w" , err )
468+ }
469+ // validate the resources in the backend
470+ err = vol .ValidateResourcesForCreate (volumeGroupSnapshot )
471+ if err != nil {
472+ return fmt .Errorf ("failed to validate resources for create: %w" , err )
473+ }
474+ // Delete the pods
475+ err = v .DeletePods (pods )
476+ if err != nil {
477+ return fmt .Errorf ("failed to delete pods: %w" , err )
478+ }
479+ // Delete the clones
480+ err = v .DeletePVCs (clonePVCs )
481+ if err != nil {
482+ return fmt .Errorf ("failed to delete clones: %w" , err )
483+ }
484+ // Delete the PVCs
485+ err = v .DeletePVCs (pvcs )
486+ if err != nil {
487+ return fmt .Errorf ("failed to delete PVCs: %w" , err )
488+ }
489+ // Delete the volume group snapshot
490+ err = v .DeleteVolumeGroupSnapshot (volumeGroupSnapshot .Name )
491+ if err != nil {
492+ return fmt .Errorf ("failed to delete volume group snapshot: %w" , err )
493+ }
494+ // validate the resources in the backend after deleting the resources
495+ err = vol .ValidateResourcesForDelete ()
496+ if err != nil {
497+ return fmt .Errorf ("failed to validate resources for delete: %w" , err )
498+ }
499+ // Delete the volume group snapshot class
500+ err = v .DeleteVolumeGroupSnapshotClass (vgscName )
501+ if err != nil {
502+ return fmt .Errorf ("failed to delete volume group snapshot class: %w" , err )
503+ }
502504 }
503505
504506 return nil
0 commit comments