integration: start informer and scheduler outside of InitTestScheduler

In case two or more controllers share the informers created through InitTestScheduler,
it's not safe to start the informers until all controllers set their informer
indexers. Otherwise, some controller might fail to register their indexers
in time. Thus, it's responsibility of each consumer to make sure all informers
are started after all controllers had time to get initiliazed.
This commit is contained in:
Jan Chaloupka
2020-05-13 11:39:56 +02:00
parent 61f00365d4
commit 65e9826f79
8 changed files with 47 additions and 20 deletions

View File

@@ -161,13 +161,14 @@ func TestTaintBasedEvictions(t *testing.T) {
return
}
go nc.Run(testCtx.Ctx.Done())
// Waiting for all controller sync.
// Waiting for all controllers to sync
externalInformers.Start(testCtx.Ctx.Done())
externalInformers.WaitForCacheSync(testCtx.Ctx.Done())
testCtx.InformerFactory.Start(testCtx.Ctx.Done())
testCtx.InformerFactory.WaitForCacheSync(testCtx.Ctx.Done())
testutils.SyncInformerFactory(testCtx)
// Run all controllers
go nc.Run(testCtx.Ctx.Done())
go testCtx.Scheduler.Run(testCtx.Ctx)
nodeRes := v1.ResourceList{
v1.ResourceCPU: resource.MustParse("4000m"),