e2e: remove passing waitgroups for go routines

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

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2021-06-28 15:26:48 +05:30 committed by mergify[bot]
parent 4657ac7f00
commit 36f4c0cabb

View File

@ -803,11 +803,11 @@ var _ = Describe("cephfs", func() {
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
// create snapshot // create snapshot
for i := 0; i < totalCount; i++ { 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) s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = createSnapshot(&s, deployTimeout) wgErrs[n] = createSnapshot(&s, deployTimeout)
w.Done() wg.Done()
}(&wg, i, snap) }(i, snap)
} }
wg.Wait() wg.Wait()
@ -839,7 +839,7 @@ var _ = Describe("cephfs", func() {
wg.Add(totalCount) wg.Add(totalCount)
for i := 0; i < totalCount; i++ { 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) name := fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout) wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
if wgErrs[n] == nil { if wgErrs[n] == nil {
@ -848,8 +848,8 @@ var _ = Describe("cephfs", func() {
wgErrs[n] = err wgErrs[n] = err
} }
} }
w.Done() wg.Done()
}(&wg, i, *pvcClone, *appClone) }(i, *pvcClone, *appClone)
} }
wg.Wait() wg.Wait()
@ -869,12 +869,12 @@ var _ = Describe("cephfs", func() {
wg.Add(totalCount) wg.Add(totalCount)
// delete clone and app // delete clone and app
for i := 0; i < totalCount; i++ { 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) name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name p.Spec.DataSource.Name = name
wgErrs[n] = deletePVCAndApp(name, f, &p, &a) wgErrs[n] = deletePVCAndApp(name, f, &p, &a)
w.Done() wg.Done()
}(&wg, i, *pvcClone, *appClone) }(i, *pvcClone, *appClone)
} }
wg.Wait() wg.Wait()
@ -895,7 +895,7 @@ var _ = Describe("cephfs", func() {
// app // app
wg.Add(totalCount) wg.Add(totalCount)
for i := 0; i < totalCount; i++ { 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) name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name p.Spec.DataSource.Name = name
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout) wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
@ -905,8 +905,8 @@ var _ = Describe("cephfs", func() {
wgErrs[n] = err wgErrs[n] = err
} }
} }
w.Done() wg.Done()
}(&wg, i, *pvcClone, *appClone) }(i, *pvcClone, *appClone)
} }
wg.Wait() wg.Wait()
@ -926,11 +926,11 @@ var _ = Describe("cephfs", func() {
wg.Add(totalCount) wg.Add(totalCount)
// delete snapshot // delete snapshot
for i := 0; i < totalCount; i++ { 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) s.Name = fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = deleteSnapshot(&s, deployTimeout) wgErrs[n] = deleteSnapshot(&s, deployTimeout)
w.Done() wg.Done()
}(&wg, i, snap) }(i, snap)
} }
wg.Wait() wg.Wait()
@ -948,12 +948,12 @@ var _ = Describe("cephfs", func() {
wg.Add(totalCount) wg.Add(totalCount)
// delete clone and app // delete clone and app
for i := 0; i < totalCount; i++ { 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) name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name p.Spec.DataSource.Name = name
wgErrs[n] = deletePVCAndApp(name, f, &p, &a) wgErrs[n] = deletePVCAndApp(name, f, &p, &a)
w.Done() wg.Done()
}(&wg, i, *pvcClone, *appClone) }(i, *pvcClone, *appClone)
} }
wg.Wait() wg.Wait()
@ -1029,11 +1029,11 @@ var _ = Describe("cephfs", func() {
wg.Add(totalCount) wg.Add(totalCount)
// create clone and bind it to an app // create clone and bind it to an app
for i := 0; i < totalCount; i++ { 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) name := fmt.Sprintf("%s%d", f.UniqueName, n)
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout) wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
w.Done() wg.Done()
}(&wg, i, *pvcClone, *appClone) }(i, *pvcClone, *appClone)
} }
wg.Wait() wg.Wait()
@ -1060,12 +1060,12 @@ var _ = Describe("cephfs", func() {
wg.Add(totalCount) wg.Add(totalCount)
// delete clone and app // delete clone and app
for i := 0; i < totalCount; i++ { 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) name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name p.Spec.DataSource.Name = name
wgErrs[n] = deletePVCAndApp(name, f, &p, &a) wgErrs[n] = deletePVCAndApp(name, f, &p, &a)
w.Done() wg.Done()
}(&wg, i, *pvcClone, *appClone) }(i, *pvcClone, *appClone)
} }
wg.Wait() wg.Wait()