Skip to content

Commit

Permalink
Merge pull request #121927 from alexanderConstantinescu/fix-flaky-Tes…
Browse files Browse the repository at this point in the history
…tSlowNodeSync

`TestSlowNodeSync`: attempt fixing flake by allowing informer cache to get populated
  • Loading branch information
k8s-ci-robot committed Nov 29, 2023
2 parents 022d50f + dd6e286 commit a8f6ea2
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake"
Expand Down Expand Up @@ -1444,6 +1445,15 @@ func TestSlowNodeSync(t *testing.T) {
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
if err := controller.syncService(context.TODO(), key); err != nil {
t.Fatalf("unexpected service sync error, err: %v", err)
Expand Down

0 comments on commit a8f6ea2

Please sign in to comment.