Call non-blocking informerFactory.Start synchronously to avoid races
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
This commit is contained in:
@@ -223,7 +223,7 @@ func setupGC(t *testing.T, config *restclient.Config) garbageCollector {
|
||||
t.Fatal(err)
|
||||
}
|
||||
stop := make(chan struct{})
|
||||
go sharedInformers.Start(stop)
|
||||
sharedInformers.Start(stop)
|
||||
return garbageCollector{gc, stop}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ func TestTypeChecking(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("cannot create controller: %v", err)
|
||||
}
|
||||
go informerFactory.Start(ctx.Done())
|
||||
informerFactory.Start(ctx.Done())
|
||||
go controller.Run(ctx, 1)
|
||||
err = wait.PollUntilContextCancel(ctx, time.Second, false, func(ctx context.Context) (done bool, err error) {
|
||||
name := policy.Name
|
||||
|
||||
@@ -152,7 +152,7 @@ func TestSyncHandler(t *testing.T) {
|
||||
ec, _ := c.(*ephemeralController)
|
||||
|
||||
// Ensure informers are up-to-date.
|
||||
go informerFactory.Start(ctx.Done())
|
||||
informerFactory.Start(ctx.Done())
|
||||
informerFactory.WaitForCacheSync(ctx.Done())
|
||||
cache.WaitForCacheSync(ctx.Done(), podInformer.Informer().HasSynced, pvcInformer.Informer().HasSynced)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user