From da35add03f73e26496c3ec466a97dc7597a83f4e Mon Sep 17 00:00:00 2001 From: Mengjiao Liu Date: Tue, 15 Jun 2021 18:44:39 +0800 Subject: [PATCH] Rename master to apiserver in test/integration --- test/integration/node/lifecycle_test.go | 2 +- test/integration/scheduler/extender_test.go | 2 +- test/integration/scheduler/framework_test.go | 54 +++++++++---------- test/integration/scheduler/preemption_test.go | 6 +-- test/integration/scheduler/priorities_test.go | 2 +- test/integration/scheduler/queue_test.go | 2 +- test/integration/scheduler/taint_test.go | 2 +- test/integration/scheduler/util.go | 4 +- test/integration/util/util.go | 6 +-- test/integration/volumescheduling/util.go | 4 +- .../volumescheduling/volume_binding_test.go | 4 +- .../volume_capacity_priority_test.go | 2 +- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/test/integration/node/lifecycle_test.go b/test/integration/node/lifecycle_test.go index 871ab83bb9e..b0ef1cf6a48 100644 --- a/test/integration/node/lifecycle_test.go +++ b/test/integration/node/lifecycle_test.go @@ -120,7 +120,7 @@ func TestTaintBasedEvictions(t *testing.T) { ) for i, test := range tests { t.Run(test.name, func(t *testing.T) { - testCtx := testutils.InitTestMaster(t, "taint-based-evictions", admission) + testCtx := testutils.InitTestAPIServer(t, "taint-based-evictions", admission) // Build clientset and informers for controllers. externalClientset := kubernetes.NewForConfigOrDie(&restclient.Config{ diff --git a/test/integration/scheduler/extender_test.go b/test/integration/scheduler/extender_test.go index 9d3bd10ed31..bbdb9b0c2cd 100644 --- a/test/integration/scheduler/extender_test.go +++ b/test/integration/scheduler/extender_test.go @@ -281,7 +281,7 @@ func machine3Prioritizer(pod *v1.Pod, nodes *v1.NodeList) (*extenderv1.HostPrior } func TestSchedulerExtender(t *testing.T) { - testCtx := testutils.InitTestMaster(t, "scheduler-extender", nil) + testCtx := testutils.InitTestAPIServer(t, "scheduler-extender", nil) clientSet := testCtx.ClientSet extender1 := &Extender{ diff --git a/test/integration/scheduler/framework_test.go b/test/integration/scheduler/framework_test.go index 41be821ea83..083dc51e552 100644 --- a/test/integration/scheduler/framework_test.go +++ b/test/integration/scheduler/framework_test.go @@ -526,8 +526,8 @@ func TestPreFilterPlugin(t *testing.T) { }}, }) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "prefilter-plugin", nil), 2, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "prefilter-plugin", nil), 2, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -690,10 +690,10 @@ func TestPostFilterPlugin(t *testing.T) { }, }}}) - // Create the master and the scheduler with the test plugin set. + // Create the API server and the scheduler with the test plugin set. testCtx := initTestSchedulerForFrameworkTest( t, - testutils.InitTestMaster(t, fmt.Sprintf("postfilter%v-", i), nil), + testutils.InitTestAPIServer(t, fmt.Sprintf("postfilter%v-", i), nil), int(tt.numNodes), scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry), @@ -759,7 +759,7 @@ func TestScorePlugin(t *testing.T) { }}, }) - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "score-plugin", nil), 10, + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "score-plugin", nil), 10, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -837,7 +837,7 @@ func TestNormalizeScorePlugin(t *testing.T) { }}, }) - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "score-plugin", nil), 10, + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "score-plugin", nil), 10, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry)) @@ -884,8 +884,8 @@ func TestReservePluginReserve(t *testing.T) { }}, }) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "reserve-plugin-reserve", nil), 2, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "reserve-plugin-reserve", nil), 2, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -955,8 +955,8 @@ func TestPrebindPlugin(t *testing.T) { }}, }) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "prebind-plugin", nil), 2, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "prebind-plugin", nil), 2, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -1143,7 +1143,7 @@ type pluginInvokeEvent struct { // TestBindPlugin tests invocation of bind plugins. func TestBindPlugin(t *testing.T) { - testContext := testutils.InitTestMaster(t, "bind-plugin", nil) + testContext := testutils.InitTestAPIServer(t, "bind-plugin", nil) bindPlugin1 := &BindPlugin{PluginName: "bind-plugin-1", client: testContext.ClientSet} bindPlugin2 := &BindPlugin{PluginName: "bind-plugin-2", client: testContext.ClientSet} reservePlugin := &ReservePlugin{name: "mock-reserve-plugin"} @@ -1376,8 +1376,8 @@ func TestPostBindPlugin(t *testing.T) { }}, }) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "postbind-plugin", nil), 2, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "postbind-plugin", nil), 2, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -1421,8 +1421,8 @@ func TestPermitPlugin(t *testing.T) { perPlugin := &PermitPlugin{name: permitPluginName} registry, prof := initRegistryAndConfig(t, perPlugin) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "permit-plugin", nil), 2, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "permit-plugin", nil), 2, scheduler.WithProfiles(prof), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -1518,8 +1518,8 @@ func TestMultiplePermitPlugins(t *testing.T) { perPlugin2 := &PermitPlugin{name: "permit-plugin-2"} registry, prof := initRegistryAndConfig(t, perPlugin1, perPlugin2) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "multi-permit-plugin", nil), 2, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "multi-permit-plugin", nil), 2, scheduler.WithProfiles(prof), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -1573,8 +1573,8 @@ func TestPermitPluginsCancelled(t *testing.T) { perPlugin2 := &PermitPlugin{name: "permit-plugin-2"} registry, prof := initRegistryAndConfig(t, perPlugin1, perPlugin2) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "permit-plugins", nil), 2, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "permit-plugins", nil), 2, scheduler.WithProfiles(prof), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -1614,9 +1614,9 @@ func TestCoSchedulingWithPermitPlugin(t *testing.T) { permitPlugin := &PermitPlugin{name: permitPluginName} registry, prof := initRegistryAndConfig(t, permitPlugin) - // Create the master and the scheduler with the test plugin set. + // Create the API server and the scheduler with the test plugin set. // TODO Make the subtests not share scheduler instances. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "permit-plugin", nil), 2, + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "permit-plugin", nil), 2, scheduler.WithProfiles(prof), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -1715,8 +1715,8 @@ func TestFilterPlugin(t *testing.T) { }}, }) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "filter-plugin", nil), 1, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "filter-plugin", nil), 1, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -1787,8 +1787,8 @@ func TestPreScorePlugin(t *testing.T) { }}, }) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "pre-score-plugin", nil), 2, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "pre-score-plugin", nil), 2, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) @@ -1843,8 +1843,8 @@ func TestPreemptWithPermitPlugin(t *testing.T) { permitPlugin := &PermitPlugin{} registry, prof := initRegistryAndConfig(t, permitPlugin) - // Create the master and the scheduler with the test plugin set. - testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "preempt-with-permit-plugin", nil), 0, + // Create the API server and the scheduler with the test plugin set. + testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "preempt-with-permit-plugin", nil), 0, scheduler.WithProfiles(prof), scheduler.WithFrameworkOutOfTreeRegistry(registry)) defer testutils.CleanupTest(t, testCtx) diff --git a/test/integration/scheduler/preemption_test.go b/test/integration/scheduler/preemption_test.go index c3d4b63d7c7..f5e84f19ec8 100644 --- a/test/integration/scheduler/preemption_test.go +++ b/test/integration/scheduler/preemption_test.go @@ -153,7 +153,7 @@ func TestPreemption(t *testing.T) { }) testCtx := testutils.InitTestSchedulerWithOptions(t, - testutils.InitTestMaster(t, "preemption", nil), + testutils.InitTestAPIServer(t, "preemption", nil), nil, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithFrameworkOutOfTreeRegistry(registry)) @@ -601,7 +601,7 @@ func TestDisablePreemption(t *testing.T) { // This test verifies that system critical priorities are created automatically and resolved properly. func TestPodPriorityResolution(t *testing.T) { admission := priority.NewPlugin() - testCtx := testutils.InitTestScheduler(t, testutils.InitTestMaster(t, "preemption", admission), nil) + testCtx := testutils.InitTestScheduler(t, testutils.InitTestAPIServer(t, "preemption", admission), nil) defer testutils.CleanupTest(t, testCtx) cs := testCtx.ClientSet @@ -1321,7 +1321,7 @@ func TestPDBInPreemption(t *testing.T) { } func initTestPreferNominatedNode(t *testing.T, nsPrefix string, opts ...scheduler.Option) *testutils.TestContext { - testCtx := testutils.InitTestSchedulerWithOptions(t, testutils.InitTestMaster(t, nsPrefix, nil), nil, opts...) + testCtx := testutils.InitTestSchedulerWithOptions(t, testutils.InitTestAPIServer(t, nsPrefix, nil), nil, opts...) testutils.SyncInformerFactory(testCtx) // wraps the NextPod() method to make it appear the preemption has been done already and the nominated node has been set. f := testCtx.Scheduler.NextPod diff --git a/test/integration/scheduler/priorities_test.go b/test/integration/scheduler/priorities_test.go index ab0e97ce981..65f4c2e0930 100644 --- a/test/integration/scheduler/priorities_test.go +++ b/test/integration/scheduler/priorities_test.go @@ -62,7 +62,7 @@ func initTestSchedulerForPriorityTest(t *testing.T, scorePluginName string) *tes }) testCtx := testutils.InitTestSchedulerWithOptions( t, - testutils.InitTestMaster(t, strings.ToLower(scorePluginName), nil), + testutils.InitTestAPIServer(t, strings.ToLower(scorePluginName), nil), nil, scheduler.WithProfiles(cfg.Profiles...), ) diff --git a/test/integration/scheduler/queue_test.go b/test/integration/scheduler/queue_test.go index 10a01f47c52..35e0fecdb35 100644 --- a/test/integration/scheduler/queue_test.go +++ b/test/integration/scheduler/queue_test.go @@ -81,7 +81,7 @@ func TestServiceAffinityEnqueue(t *testing.T) { // Use zero backoff seconds to bypass backoffQ. testCtx := testutils.InitTestSchedulerWithOptions( t, - testutils.InitTestMaster(t, "serviceaffinity-enqueue", nil), + testutils.InitTestAPIServer(t, "serviceaffinity-enqueue", nil), nil, scheduler.WithProfiles(cfg.Profiles...), scheduler.WithPodInitialBackoffSeconds(0), diff --git a/test/integration/scheduler/taint_test.go b/test/integration/scheduler/taint_test.go index c0baec2efc9..068cfa1aabe 100644 --- a/test/integration/scheduler/taint_test.go +++ b/test/integration/scheduler/taint_test.go @@ -63,7 +63,7 @@ func TestTaintNodeByCondition(t *testing.T) { // Build PodToleration Admission. admission := podtolerationrestriction.NewPodTolerationsPlugin(&pluginapi.Configuration{}) - testCtx := testutils.InitTestMaster(t, "default", admission) + testCtx := testutils.InitTestAPIServer(t, "default", admission) // Build clientset and informers for controllers. externalClientset := kubernetes.NewForConfigOrDie(&restclient.Config{ diff --git a/test/integration/scheduler/util.go b/test/integration/scheduler/util.go index cbb4aeb08d2..e9dc8cfbd2d 100644 --- a/test/integration/scheduler/util.go +++ b/test/integration/scheduler/util.go @@ -83,7 +83,7 @@ func initDisruptionController(t *testing.T, testCtx *testutils.TestContext) *dis // initTest initializes a test environment and creates master and scheduler with default // configuration. func initTest(t *testing.T, nsPrefix string, opts ...scheduler.Option) *testutils.TestContext { - testCtx := testutils.InitTestSchedulerWithOptions(t, testutils.InitTestMaster(t, nsPrefix, nil), nil, opts...) + testCtx := testutils.InitTestSchedulerWithOptions(t, testutils.InitTestAPIServer(t, nsPrefix, nil), nil, opts...) testutils.SyncInformerFactory(testCtx) go testCtx.Scheduler.Run(testCtx.Ctx) return testCtx @@ -105,7 +105,7 @@ func initTestDisablePreemption(t *testing.T, nsPrefix string) *testutils.TestCon }}, }) testCtx := testutils.InitTestSchedulerWithOptions( - t, testutils.InitTestMaster(t, nsPrefix, nil), nil, + t, testutils.InitTestAPIServer(t, nsPrefix, nil), nil, scheduler.WithProfiles(cfg.Profiles...)) testutils.SyncInformerFactory(testCtx) go testCtx.Scheduler.Run(testCtx.Ctx) diff --git a/test/integration/util/util.go b/test/integration/util/util.go index dfbe9b731d9..487a7efb7eb 100644 --- a/test/integration/util/util.go +++ b/test/integration/util/util.go @@ -319,16 +319,16 @@ func UpdateNodeStatus(cs clientset.Interface, node *v1.Node) error { return err } -// InitTestMaster initializes a test environment and creates a master with default +// InitTestAPIServer initializes a test environment and creates an API server with default // configuration. -func InitTestMaster(t *testing.T, nsPrefix string, admission admission.Interface) *TestContext { +func InitTestAPIServer(t *testing.T, nsPrefix string, admission admission.Interface) *TestContext { ctx, cancelFunc := context.WithCancel(context.Background()) testCtx := TestContext{ Ctx: ctx, CancelFn: cancelFunc, } - // 1. Create control plane + // 1. Create API server h := &framework.APIServerHolder{Initialized: make(chan struct{})} s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { <-h.Initialized diff --git a/test/integration/volumescheduling/util.go b/test/integration/volumescheduling/util.go index a523aa2c823..d6f118a44c1 100644 --- a/test/integration/volumescheduling/util.go +++ b/test/integration/volumescheduling/util.go @@ -54,10 +54,10 @@ type testContext struct { cancelFn context.CancelFunc } -// initTestMaster initializes a test environment and creates a master with default +// initTestAPIServer initializes a test environment and creates a master with default // configuration. Alpha resources are enabled automatically if the corresponding feature // is enabled. -func initTestMaster(t *testing.T, nsPrefix string, admission admission.Interface) *testContext { +func initTestAPIServer(t *testing.T, nsPrefix string, admission admission.Interface) *testContext { ctx, cancelFunc := context.WithCancel(context.Background()) testCtx := testContext{ ctx: ctx, diff --git a/test/integration/volumescheduling/volume_binding_test.go b/test/integration/volumescheduling/volume_binding_test.go index fd14ceaf217..884539ee839 100644 --- a/test/integration/volumescheduling/volume_binding_test.go +++ b/test/integration/volumescheduling/volume_binding_test.go @@ -1006,7 +1006,7 @@ func TestRescheduleProvisioning(t *testing.T) { // Set feature gates controllerCh := make(chan struct{}) - testCtx := initTestMaster(t, "reschedule-volume-provision", nil) + testCtx := initTestAPIServer(t, "reschedule-volume-provision", nil) clientset := testCtx.clientSet ns := testCtx.ns.Name @@ -1062,7 +1062,7 @@ func TestRescheduleProvisioning(t *testing.T) { } func setupCluster(t *testing.T, nsName string, numberOfNodes int, resyncPeriod time.Duration, provisionDelaySeconds int) *testConfig { - textCtx := initTestSchedulerWithOptions(t, initTestMaster(t, nsName, nil), resyncPeriod) + textCtx := initTestSchedulerWithOptions(t, initTestAPIServer(t, nsName, nil), resyncPeriod) clientset := textCtx.clientSet ns := textCtx.ns.Name diff --git a/test/integration/volumescheduling/volume_capacity_priority_test.go b/test/integration/volumescheduling/volume_capacity_priority_test.go index 75792988f9a..aac6c7809b9 100644 --- a/test/integration/volumescheduling/volume_capacity_priority_test.go +++ b/test/integration/volumescheduling/volume_capacity_priority_test.go @@ -46,7 +46,7 @@ func mergeNodeLabels(node *v1.Node, labels map[string]string) *v1.Node { } func setupClusterForVolumeCapacityPriority(t *testing.T, nsName string, resyncPeriod time.Duration, provisionDelaySeconds int) *testConfig { - textCtx := initTestSchedulerWithOptions(t, initTestMaster(t, nsName, nil), resyncPeriod) + textCtx := initTestSchedulerWithOptions(t, initTestAPIServer(t, nsName, nil), resyncPeriod) clientset := textCtx.clientSet ns := textCtx.ns.Name