mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Merge pull request #92713 from liggitt/deflake-list-rv-0
Deflake TestListResourceVersion0
This commit is contained in:
commit
3f585835d0
@ -54,6 +54,7 @@ go_test(
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/protobuf:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/streaming:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/features:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||
|
@ -49,6 +49,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/apiserver/pkg/features"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
@ -548,6 +549,20 @@ func TestListResourceVersion0(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if tc.watchCacheEnabled {
|
||||
// poll until the watch cache has the full list in memory
|
||||
err := wait.PollImmediate(time.Second, wait.ForeverTestTimeout, func() (bool, error) {
|
||||
list, err := clientSet.AppsV1().ReplicaSets(ns.Name).List(context.Background(), metav1.ListOptions{ResourceVersion: "0"})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return len(list.Items) == 10, nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("error waiting for watch cache to observe the full list: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
pagerFn := func(opts metav1.ListOptions) (runtime.Object, error) {
|
||||
return rsClient.List(context.TODO(), opts)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user