mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 20:17:41 +00:00
TestSlowNodeSync: fix flake by allowing informer cache to get populated
This commit is contained in:
parent
c3ff08250e
commit
dd6e286a1a
@ -37,6 +37,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/client-go/informers"
|
"k8s.io/client-go/informers"
|
||||||
"k8s.io/client-go/kubernetes/fake"
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
@ -1444,6 +1445,15 @@ func TestSlowNodeSync(t *testing.T) {
|
|||||||
t.Fatalf("error creating node3, err: %v", err)
|
t.Fatalf("error creating node3, err: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow a bit of time for the informer cache to get populated with the new
|
||||||
|
// node
|
||||||
|
if err := wait.PollUntilContextCancel(wait.ContextForChannel(stopCh), 10*time.Millisecond, true, func(ctx context.Context) (done bool, err error) {
|
||||||
|
n3, _ := controller.nodeLister.Get("node3")
|
||||||
|
return n3 != nil, nil
|
||||||
|
}); err != nil {
|
||||||
|
t.Fatalf("informer cache was never populated with node3")
|
||||||
|
}
|
||||||
|
|
||||||
// Sync the service
|
// Sync the service
|
||||||
if err := controller.syncService(context.TODO(), key); err != nil {
|
if err := controller.syncService(context.TODO(), key); err != nil {
|
||||||
t.Fatalf("unexpected service sync error, err: %v", err)
|
t.Fatalf("unexpected service sync error, err: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user