e2e: remove passing waitgroups reference for go routines

We are unwantedly passing around waitgroups which is not required.
This address the same inside e2e/rbd_helper.go and remove the waitgroup
arg

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2021-06-28 13:58:46 +05:30 committed by mergify[bot]
parent 7f7a41d23a
commit 053f7ee213

View File

@ -268,7 +268,6 @@ func validateCloneInDifferentPool(f *framework.Framework, snapshotPool, cloneSc,
var wg sync.WaitGroup
totalCount := 10
wgErrs := make([]error, totalCount)
wg.Add(totalCount)
pvc, err := loadPVC(pvcPath)
if err != nil {
return fmt.Errorf("failed to load PVC with error %v", err)
@ -284,12 +283,13 @@ func validateCloneInDifferentPool(f *framework.Framework, snapshotPool, cloneSc,
snap.Namespace = f.UniqueName
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
// create snapshot
wg.Add(totalCount)
for i := 0; i < totalCount; i++ {
go func(w *sync.WaitGroup, n int, s snapapi.VolumeSnapshot) {
go func(n int, s snapapi.VolumeSnapshot) {
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = createSnapshot(&s, deployTimeout)
w.Done()
}(&wg, i, snap)
wg.Done()
}(i, snap)
}
wg.Wait()
@ -324,11 +324,11 @@ func validateCloneInDifferentPool(f *framework.Framework, snapshotPool, cloneSc,
// create multiple PVCs from same snapshot
wg.Add(totalCount)
for i := 0; i < totalCount; i++ {
go func(w *sync.WaitGroup, n int, p v1.PersistentVolumeClaim, a v1.Pod) {
go func(n int, p v1.PersistentVolumeClaim, a v1.Pod) {
name := fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
w.Done()
}(&wg, i, *pvcClone, *appClone)
wg.Done()
}(i, *pvcClone, *appClone)
}
wg.Wait()
@ -348,12 +348,12 @@ func validateCloneInDifferentPool(f *framework.Framework, snapshotPool, cloneSc,
wg.Add(totalCount)
// delete clone and app
for i := 0; i < totalCount; i++ {
go func(w *sync.WaitGroup, n int, p v1.PersistentVolumeClaim, a v1.Pod) {
go func(n int, p v1.PersistentVolumeClaim, a v1.Pod) {
name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name
wgErrs[n] = deletePVCAndApp(name, f, &p, &a)
w.Done()
}(&wg, i, *pvcClone, *appClone)
wg.Done()
}(i, *pvcClone, *appClone)
}
wg.Wait()
@ -372,11 +372,11 @@ func validateCloneInDifferentPool(f *framework.Framework, snapshotPool, cloneSc,
wg.Add(totalCount)
// delete snapshot
for i := 0; i < totalCount; i++ {
go func(w *sync.WaitGroup, n int, s snapapi.VolumeSnapshot) {
go func(n int, s snapapi.VolumeSnapshot) {
s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = deleteSnapshot(&s, deployTimeout)
w.Done()
}(&wg, i, snap)
wg.Done()
}(i, snap)
}
wg.Wait()