File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,7 @@ var _ = SIGDescribe("Pods Extended", func() {
263
263
start := time .Now ()
264
264
created := podClient .Create (pod )
265
265
ch := make (chan []watch.Event )
266
+ waitForWatch := make (chan struct {})
266
267
go func () {
267
268
defer ginkgo .GinkgoRecover ()
268
269
defer close (ch )
@@ -275,6 +276,7 @@ var _ = SIGDescribe("Pods Extended", func() {
275
276
return
276
277
}
277
278
defer w .Stop ()
279
+ close (waitForWatch )
278
280
events := []watch.Event {
279
281
{Type : watch .Added , Object : created },
280
282
}
@@ -291,6 +293,10 @@ var _ = SIGDescribe("Pods Extended", func() {
291
293
ch <- events
292
294
}()
293
295
296
+ select {
297
+ case <- ch : // in case the goroutine above exits before establishing the watch
298
+ case <- waitForWatch : // when the watch is established
299
+ }
294
300
t := time .Duration (rand .Intn (delay )) * time .Millisecond
295
301
time .Sleep (t )
296
302
err := podClient .Delete (context .TODO (), pod .Name , metav1.DeleteOptions {})
You can’t perform that action at this time.
0 commit comments