Set 0 sync period in scheduler integration test

This commit is contained in:
Wei Huang 2020-10-29 12:27:46 -07:00
parent dd45603707
commit 185093bd4e
No known key found for this signature in database
GPG Key ID: BE5E9752F8B6E005
7 changed files with 9 additions and 11 deletions

View File

@ -1173,7 +1173,7 @@ func TestBindPlugin(t *testing.T) {
} }
// Create the scheduler with the test plugin set. // Create the scheduler with the test plugin set.
testCtx := testutils.InitTestSchedulerWithOptions(t, testContext, nil, time.Second, testCtx := testutils.InitTestSchedulerWithOptions(t, testContext, nil,
scheduler.WithProfiles(prof), scheduler.WithProfiles(prof),
scheduler.WithFrameworkOutOfTreeRegistry(registry)) scheduler.WithFrameworkOutOfTreeRegistry(registry))
testutils.SyncInformerFactory(testCtx) testutils.SyncInformerFactory(testCtx)
@ -1895,7 +1895,7 @@ func TestPreemptWithPermitPlugin(t *testing.T) {
} }
func initTestSchedulerForFrameworkTest(t *testing.T, testCtx *testutils.TestContext, nodeCount int, opts ...scheduler.Option) *testutils.TestContext { func initTestSchedulerForFrameworkTest(t *testing.T, testCtx *testutils.TestContext, nodeCount int, opts ...scheduler.Option) *testutils.TestContext {
testCtx = testutils.InitTestSchedulerWithOptions(t, testCtx, nil, time.Second, opts...) testCtx = testutils.InitTestSchedulerWithOptions(t, testCtx, nil, opts...)
testutils.SyncInformerFactory(testCtx) testutils.SyncInformerFactory(testCtx)
go testCtx.Scheduler.Run(testCtx.Ctx) go testCtx.Scheduler.Run(testCtx.Ctx)

View File

@ -149,7 +149,7 @@ func TestPreemption(t *testing.T) {
} }
testCtx := testutils.InitTestSchedulerWithOptions(t, testCtx := testutils.InitTestSchedulerWithOptions(t,
testutils.InitTestMaster(t, "preemption", nil), testutils.InitTestMaster(t, "preemption", nil),
nil, time.Second, nil,
scheduler.WithProfiles(prof), scheduler.WithProfiles(prof),
scheduler.WithFrameworkOutOfTreeRegistry(registry)) scheduler.WithFrameworkOutOfTreeRegistry(registry))
testutils.SyncInformerFactory(testCtx) testutils.SyncInformerFactory(testCtx)

View File

@ -57,7 +57,6 @@ func initTestSchedulerForPriorityTest(t *testing.T, scorePluginName string) *tes
t, t,
testutils.InitTestMaster(t, strings.ToLower(scorePluginName), nil), testutils.InitTestMaster(t, strings.ToLower(scorePluginName), nil),
nil, nil,
0,
scheduler.WithProfiles(prof), scheduler.WithProfiles(prof),
) )
testutils.SyncInformerFactory(testCtx) testutils.SyncInformerFactory(testCtx)

View File

@ -561,7 +561,7 @@ func TestMultipleSchedulers(t *testing.T) {
// 5. create and start a scheduler with name "foo-scheduler" // 5. create and start a scheduler with name "foo-scheduler"
fooProf := kubeschedulerconfig.KubeSchedulerProfile{SchedulerName: fooScheduler} fooProf := kubeschedulerconfig.KubeSchedulerProfile{SchedulerName: fooScheduler}
testCtx = testutils.InitTestSchedulerWithOptions(t, testCtx, nil, time.Second, scheduler.WithProfiles(fooProf)) testCtx = testutils.InitTestSchedulerWithOptions(t, testCtx, nil, scheduler.WithProfiles(fooProf))
testutils.SyncInformerFactory(testCtx) testutils.SyncInformerFactory(testCtx)
go testCtx.Scheduler.Run(testCtx.Ctx) go testCtx.Scheduler.Run(testCtx.Ctx)

View File

@ -70,7 +70,7 @@ func TestTaintNodeByCondition(t *testing.T) {
QPS: -1, QPS: -1,
Host: testCtx.HTTPServer.URL, Host: testCtx.HTTPServer.URL,
ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}}) ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
externalInformers := informers.NewSharedInformerFactory(externalClientset, time.Second) externalInformers := informers.NewSharedInformerFactory(externalClientset, 0)
admission.SetExternalKubeClientSet(externalClientset) admission.SetExternalKubeClientSet(externalClientset)
admission.SetExternalKubeInformerFactory(externalInformers) admission.SetExternalKubeInformerFactory(externalInformers)

View File

@ -80,7 +80,7 @@ func initDisruptionController(t *testing.T, testCtx *testutils.TestContext) *dis
// initTest initializes a test environment and creates master and scheduler with default // initTest initializes a test environment and creates master and scheduler with default
// configuration. // configuration.
func initTest(t *testing.T, nsPrefix string, opts ...scheduler.Option) *testutils.TestContext { func initTest(t *testing.T, nsPrefix string, opts ...scheduler.Option) *testutils.TestContext {
testCtx := testutils.InitTestSchedulerWithOptions(t, testutils.InitTestMaster(t, nsPrefix, nil), nil, time.Second, opts...) testCtx := testutils.InitTestSchedulerWithOptions(t, testutils.InitTestMaster(t, nsPrefix, nil), nil, opts...)
testutils.SyncInformerFactory(testCtx) testutils.SyncInformerFactory(testCtx)
go testCtx.Scheduler.Run(testCtx.Ctx) go testCtx.Scheduler.Run(testCtx.Ctx)
return testCtx return testCtx
@ -101,7 +101,7 @@ func initTestDisablePreemption(t *testing.T, nsPrefix string) *testutils.TestCon
} }
testCtx := testutils.InitTestSchedulerWithOptions( testCtx := testutils.InitTestSchedulerWithOptions(
t, testutils.InitTestMaster(t, nsPrefix, nil), nil, t, testutils.InitTestMaster(t, nsPrefix, nil), nil,
time.Second, scheduler.WithProfiles(prof)) scheduler.WithProfiles(prof))
testutils.SyncInformerFactory(testCtx) testutils.SyncInformerFactory(testCtx)
go testCtx.Scheduler.Run(testCtx.Ctx) go testCtx.Scheduler.Run(testCtx.Ctx)
return testCtx return testCtx

View File

@ -373,7 +373,7 @@ func InitTestScheduler(
policy *schedulerapi.Policy, policy *schedulerapi.Policy,
) *TestContext { ) *TestContext {
// Pod preemption is enabled by default scheduler configuration. // Pod preemption is enabled by default scheduler configuration.
return InitTestSchedulerWithOptions(t, testCtx, policy, time.Second) return InitTestSchedulerWithOptions(t, testCtx, policy)
} }
// InitTestSchedulerWithOptions initializes a test environment and creates a scheduler with default // InitTestSchedulerWithOptions initializes a test environment and creates a scheduler with default
@ -382,11 +382,10 @@ func InitTestSchedulerWithOptions(
t *testing.T, t *testing.T,
testCtx *TestContext, testCtx *TestContext,
policy *schedulerapi.Policy, policy *schedulerapi.Policy,
resyncPeriod time.Duration,
opts ...scheduler.Option, opts ...scheduler.Option,
) *TestContext { ) *TestContext {
// 1. Create scheduler // 1. Create scheduler
testCtx.InformerFactory = scheduler.NewInformerFactory(testCtx.ClientSet, resyncPeriod) testCtx.InformerFactory = scheduler.NewInformerFactory(testCtx.ClientSet, 0)
var err error var err error
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{ eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{