UPSTREAM: 44760: Fix issue Flaky Test_AttachDetachControllerRecovery
@@ -24,6 +24,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
+ kcache "k8s.io/client-go/tools/cache"
"k8s.io/kubernetes/pkg/api/v1"
informers "k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions"
"k8s.io/kubernetes/pkg/controller"
@@ -168,6 +169,12 @@ func attachDetachRecoveryTestCase(t *testing.T, extraPods1 []*v1.Pod, extraPods2
informerFactory.Start(stopCh)
+ if !kcache.WaitForCacheSync(stopCh,
+ informerFactory.Core().V1().Pods().Informer().HasSynced,
+ informerFactory.Core().V1().Nodes().Informer().HasSynced) {
+ t.Fatalf("Error waiting for the informer caches to sync")
+ }
+
// Make sure the nodes and pods are in the inforer cache
i = 0
nodeList, err := informerFactory.Core().V1().Nodes().Lister().List(labels.Everything())
