diff --git a/test/integration/scheduler/scheduler_test.go b/test/integration/scheduler/scheduler_test.go index 679aa86176b..718b5858d19 100644 --- a/test/integration/scheduler/scheduler_test.go +++ b/test/integration/scheduler/scheduler_test.go @@ -354,7 +354,7 @@ func TestUnschedulableNodes(t *testing.T) { context := initTest(t, "unschedulable-nodes") defer cleanupTest(t, context) - nodeLister := context.schedulerConfig.NodeLister + nodeLister := context.schedulerConfigArgs.NodeInformer.Lister() // NOTE: This test cannot run in parallel, because it is creating and deleting // non-namespaced objects (Nodes). defer context.clientSet.CoreV1().Nodes().DeleteCollection(nil, metav1.ListOptions{}) @@ -605,8 +605,8 @@ func TestMultiScheduler(t *testing.T) { stopCh := make(chan struct{}) defer close(stopCh) - schedulerConfigFactory2 := createConfiguratorWithPodInformer(fooScheduler, clientSet2, podInformer2, informerFactory2, schedulerframework.NewRegistry(), - nil, []kubeschedulerconfig.PluginConfig{}, stopCh) + schedulerConfigFactory2 := factory.NewConfigFactory(createConfiguratorArgsWithPodInformer(fooScheduler, clientSet2, podInformer2, informerFactory2, schedulerframework.NewRegistry(), + nil, []kubeschedulerconfig.PluginConfig{}, stopCh)) schedulerConfig2, err := schedulerConfigFactory2.Create() if err != nil { t.Errorf("Couldn't create scheduler config: %v", err) diff --git a/test/integration/scheduler/util.go b/test/integration/scheduler/util.go index 3b3a9dbe6bc..bfeaa707f78 100644 --- a/test/integration/scheduler/util.go +++ b/test/integration/scheduler/util.go @@ -61,19 +61,19 @@ import ( ) type testContext struct { - closeFn framework.CloseFunc - httpServer *httptest.Server - ns *v1.Namespace - clientSet *clientset.Clientset - informerFactory informers.SharedInformerFactory - schedulerConfigFactory factory.Configurator - schedulerConfig *factory.Config - scheduler *scheduler.Scheduler - stopCh chan struct{} + closeFn framework.CloseFunc + httpServer *httptest.Server + ns *v1.Namespace + clientSet *clientset.Clientset + informerFactory informers.SharedInformerFactory + schedulerConfigArgs *factory.ConfigFactoryArgs + schedulerConfig *factory.Config + scheduler *scheduler.Scheduler + stopCh chan struct{} } // createConfiguratorWithPodInformer creates a configurator for scheduler. -func createConfiguratorWithPodInformer( +func createConfiguratorArgsWithPodInformer( schedulerName string, clientSet clientset.Interface, podInformer coreinformers.PodInformer, @@ -82,8 +82,8 @@ func createConfiguratorWithPodInformer( plugins *schedulerconfig.Plugins, pluginConfig []schedulerconfig.PluginConfig, stopCh <-chan struct{}, -) factory.Configurator { - return factory.NewConfigFactory(&factory.ConfigFactoryArgs{ +) *factory.ConfigFactoryArgs { + return &factory.ConfigFactoryArgs{ SchedulerName: schedulerName, Client: clientSet, NodeInformer: informerFactory.Core().V1().Nodes(), @@ -105,7 +105,7 @@ func createConfiguratorWithPodInformer( PercentageOfNodesToScore: schedulerapi.DefaultPercentageOfNodesToScore, BindTimeoutSeconds: 600, StopCh: stopCh, - }) + } } // initTestMasterAndScheduler initializes a test environment and creates a master with default @@ -186,16 +186,17 @@ func initTestSchedulerWithOptions( podInformer = context.informerFactory.Core().V1().Pods() } - context.schedulerConfigFactory = createConfiguratorWithPodInformer( + context.schedulerConfigArgs = createConfiguratorArgsWithPodInformer( v1.DefaultSchedulerName, context.clientSet, podInformer, context.informerFactory, pluginRegistry, plugins, pluginConfig, context.stopCh) + configFactory := factory.NewConfigFactory(context.schedulerConfigArgs) var err error if policy != nil { - context.schedulerConfig, err = context.schedulerConfigFactory.CreateFromConfig(*policy) + context.schedulerConfig, err = configFactory.CreateFromConfig(*policy) } else { - context.schedulerConfig, err = context.schedulerConfigFactory.Create() + context.schedulerConfig, err = configFactory.Create() } if err != nil {