mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #123927 from p0lyn0mial/upstream-cacher-decrease-watcher-draining-no-bookmark-after
apiserver/storage/cacher: decrease running time of TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived
This commit is contained in:
commit
4d9b50bcb1
@ -499,10 +499,22 @@ func TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived(t *testing.T
|
||||
w = newCacheWatcher(0, filter, forget, storage.APIObjectVersioner{}, time.Now(), true, schema.GroupResource{Resource: "pods"}, "")
|
||||
w.setBookmarkAfterResourceVersion(10)
|
||||
go w.processInterval(context.Background(), intervalFromEvents(initEvents), 0)
|
||||
if w.add(&watchCacheEvent{Object: &v1.Pod{}}, time.NewTimer(1*time.Second)) {
|
||||
|
||||
// get an event so that
|
||||
// we know the w.processInterval
|
||||
// has been scheduled, and
|
||||
// it will be blocked on
|
||||
// sending the other event
|
||||
// to the result chan
|
||||
<-w.ResultChan()
|
||||
|
||||
// now, once we know, the processInterval
|
||||
// is waiting add another event that will time out
|
||||
// and start the cleanup process
|
||||
if w.add(&watchCacheEvent{Object: &v1.Pod{}}, time.NewTimer(10*time.Millisecond)) {
|
||||
t.Fatal("expected the add method to fail")
|
||||
}
|
||||
if err := wait.PollImmediate(1*time.Second, 5*time.Second, func() (bool, error) {
|
||||
if err := wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 5*time.Second, true, func(_ context.Context) (bool, error) {
|
||||
lock.RLock()
|
||||
defer lock.RUnlock()
|
||||
return count == 2, nil
|
||||
|
Loading…
Reference in New Issue
Block a user