Created
April 16, 2025 19:06
-
-
Save sttts/c9a841cd1638c45fb39ef0abf609bc1c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/staging/src/k8s.io/client-go/testing/fixture.go b/staging/src/k8s.io/client-go/testing/fixture.go | |
index 878ae7403ea..6662424f917 100644 | |
--- a/staging/src/k8s.io/client-go/testing/fixture.go | |
+++ b/staging/src/k8s.io/client-go/testing/fixture.go | |
@@ -22,6 +22,7 @@ import ( | |
"sort" | |
"strings" | |
"sync" | |
+ "time" | |
"sigs.k8s.io/structured-merge-diff/v4/typed" | |
"sigs.k8s.io/yaml" | |
@@ -361,15 +362,20 @@ func (t *tracker) Watch(logger klog.Logger, gvr schema.GroupVersionResource, ns | |
return nil, err | |
} | |
- t.lock.Lock() | |
- defer t.lock.Unlock() | |
- | |
fakewatcher := watch.NewRaceFreeFakeWithLogger(logger) | |
- if _, exists := t.watchers[gvr]; !exists { | |
- t.watchers[gvr] = make(map[string][]*watch.RaceFreeFakeWatcher) | |
- } | |
- t.watchers[gvr][ns] = append(t.watchers[gvr][ns], fakewatcher) | |
+ go func() { | |
+ time.Sleep(2 * time.Second) | |
+ | |
+ t.lock.Lock() | |
+ defer t.lock.Unlock() | |
+ | |
+ if _, exists := t.watchers[gvr]; !exists { | |
+ t.watchers[gvr] = make(map[string][]*watch.RaceFreeFakeWatcher) | |
+ } | |
+ t.watchers[gvr][ns] = append(t.watchers[gvr][ns], fakewatcher) | |
+ }() | |
+ | |
return fakewatcher, nil | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment