We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db9f1e9 commit 9a2e0fcCopy full SHA for 9a2e0fc
staging/src/k8s.io/apiserver/pkg/storage/tests/cacher_test.go
@@ -22,6 +22,7 @@ import (
22
"reflect"
23
goruntime "runtime"
24
"strconv"
25
+ "sync"
26
"testing"
27
"time"
28
@@ -941,8 +942,12 @@ func TestWatchBookmarksWithCorrectResourceVersion(t *testing.T) {
941
942
defer watcher.Stop()
943
944
done := make(chan struct{})
- defer close(done)
945
+ var wg sync.WaitGroup
946
+ wg.Add(1)
947
+ defer wg.Wait() // We must wait for the waitgroup to exit before we terminate the cache or the server in prior defers
948
+ defer close(done) // call close first, so the goroutine knows to exit
949
go func() {
950
+ defer wg.Done()
951
for i := 0; i < 100; i++ {
952
select {
953
case <-done:
0 commit comments