Commit 0eb642e 1 parent 2516d10 commit 0eb642e Copy full SHA for 0eb642e
File tree 1 file changed +13
-8
lines changed
1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -245,21 +245,26 @@ func TestConcurrency(t *testing.T) {
245
245
return
246
246
}
247
247
248
- wait := make (chan struct {})
248
+ const iterations = 10
249
+ errors := make (chan error )
249
250
250
251
go func () {
251
- for i := 0 ; i <= 10 ; i ++ {
252
- _ , err = c .Server .GroupList ()
253
- assert .NoError (t , err )
252
+ defer close (errors )
253
+
254
+ for i := 0 ; i <= iterations ; i ++ {
255
+ if _ , err := c .Server .GroupList (); err != nil {
256
+ errors <- err
257
+ }
254
258
}
255
- wait <- struct {}{}
256
259
}()
257
260
258
- for i := 0 ; i <= 10 ; i ++ {
261
+ for i := 0 ; i <= iterations ; i ++ {
259
262
_ , err = c .Server .GroupList ()
260
263
assert .NoError (t , err )
261
264
}
262
265
263
- // wait for go routine to finish
264
- <- wait
266
+ // receive errors from go-routine and wait for completion
267
+ for err := range errors {
268
+ assert .NoError (t , err )
269
+ }
265
270
}
You can’t perform that action at this time.
0 commit comments