mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Merge pull request #102877 from mengjiao-liu/clean-up-master-term
Rename master to apiserver in test/integration
This commit is contained in:
commit
0abb908638
@ -120,7 +120,7 @@ func TestTaintBasedEvictions(t *testing.T) {
|
|||||||
)
|
)
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
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.
|
// Build clientset and informers for controllers.
|
||||||
externalClientset := kubernetes.NewForConfigOrDie(&restclient.Config{
|
externalClientset := kubernetes.NewForConfigOrDie(&restclient.Config{
|
||||||
|
@ -281,7 +281,7 @@ func machine3Prioritizer(pod *v1.Pod, nodes *v1.NodeList) (*extenderv1.HostPrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulerExtender(t *testing.T) {
|
func TestSchedulerExtender(t *testing.T) {
|
||||||
testCtx := testutils.InitTestMaster(t, "scheduler-extender", nil)
|
testCtx := testutils.InitTestAPIServer(t, "scheduler-extender", nil)
|
||||||
clientSet := testCtx.ClientSet
|
clientSet := testCtx.ClientSet
|
||||||
|
|
||||||
extender1 := &Extender{
|
extender1 := &Extender{
|
||||||
|
@ -526,8 +526,8 @@ func TestPreFilterPlugin(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, "prefilter-plugin", nil), 2,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "prefilter-plugin", nil), 2,
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
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(
|
testCtx := initTestSchedulerForFrameworkTest(
|
||||||
t,
|
t,
|
||||||
testutils.InitTestMaster(t, fmt.Sprintf("postfilter%v-", i), nil),
|
testutils.InitTestAPIServer(t, fmt.Sprintf("postfilter%v-", i), nil),
|
||||||
int(tt.numNodes),
|
int(tt.numNodes),
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry),
|
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.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
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.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
|
|
||||||
@ -884,8 +884,8 @@ func TestReservePluginReserve(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, "reserve-plugin-reserve", nil), 2,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "reserve-plugin-reserve", nil), 2,
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
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.
|
// Create the API server and the scheduler with the test plugin set.
|
||||||
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "prebind-plugin", nil), 2,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "prebind-plugin", nil), 2,
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
defer testutils.CleanupTest(t, testCtx)
|
||||||
@ -1143,7 +1143,7 @@ type pluginInvokeEvent struct {
|
|||||||
|
|
||||||
// TestBindPlugin tests invocation of bind plugins.
|
// TestBindPlugin tests invocation of bind plugins.
|
||||||
func TestBindPlugin(t *testing.T) {
|
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}
|
bindPlugin1 := &BindPlugin{PluginName: "bind-plugin-1", client: testContext.ClientSet}
|
||||||
bindPlugin2 := &BindPlugin{PluginName: "bind-plugin-2", client: testContext.ClientSet}
|
bindPlugin2 := &BindPlugin{PluginName: "bind-plugin-2", client: testContext.ClientSet}
|
||||||
reservePlugin := &ReservePlugin{name: "mock-reserve-plugin"}
|
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.
|
// Create the API server and the scheduler with the test plugin set.
|
||||||
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "postbind-plugin", nil), 2,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "postbind-plugin", nil), 2,
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
defer testutils.CleanupTest(t, testCtx)
|
||||||
@ -1421,8 +1421,8 @@ func TestPermitPlugin(t *testing.T) {
|
|||||||
perPlugin := &PermitPlugin{name: permitPluginName}
|
perPlugin := &PermitPlugin{name: permitPluginName}
|
||||||
registry, prof := initRegistryAndConfig(t, perPlugin)
|
registry, prof := initRegistryAndConfig(t, perPlugin)
|
||||||
|
|
||||||
// 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, "permit-plugin", nil), 2,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "permit-plugin", nil), 2,
|
||||||
scheduler.WithProfiles(prof),
|
scheduler.WithProfiles(prof),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
defer testutils.CleanupTest(t, testCtx)
|
||||||
@ -1518,8 +1518,8 @@ func TestMultiplePermitPlugins(t *testing.T) {
|
|||||||
perPlugin2 := &PermitPlugin{name: "permit-plugin-2"}
|
perPlugin2 := &PermitPlugin{name: "permit-plugin-2"}
|
||||||
registry, prof := initRegistryAndConfig(t, perPlugin1, perPlugin2)
|
registry, prof := initRegistryAndConfig(t, perPlugin1, perPlugin2)
|
||||||
|
|
||||||
// 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, "multi-permit-plugin", nil), 2,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "multi-permit-plugin", nil), 2,
|
||||||
scheduler.WithProfiles(prof),
|
scheduler.WithProfiles(prof),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
defer testutils.CleanupTest(t, testCtx)
|
||||||
@ -1573,8 +1573,8 @@ func TestPermitPluginsCancelled(t *testing.T) {
|
|||||||
perPlugin2 := &PermitPlugin{name: "permit-plugin-2"}
|
perPlugin2 := &PermitPlugin{name: "permit-plugin-2"}
|
||||||
registry, prof := initRegistryAndConfig(t, perPlugin1, perPlugin2)
|
registry, prof := initRegistryAndConfig(t, perPlugin1, perPlugin2)
|
||||||
|
|
||||||
// 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, "permit-plugins", nil), 2,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "permit-plugins", nil), 2,
|
||||||
scheduler.WithProfiles(prof),
|
scheduler.WithProfiles(prof),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
defer testutils.CleanupTest(t, testCtx)
|
||||||
@ -1614,9 +1614,9 @@ func TestCoSchedulingWithPermitPlugin(t *testing.T) {
|
|||||||
permitPlugin := &PermitPlugin{name: permitPluginName}
|
permitPlugin := &PermitPlugin{name: permitPluginName}
|
||||||
registry, prof := initRegistryAndConfig(t, permitPlugin)
|
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.
|
// 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.WithProfiles(prof),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
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.
|
// Create the API server and the scheduler with the test plugin set.
|
||||||
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "filter-plugin", nil), 1,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "filter-plugin", nil), 1,
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
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.
|
// Create the API server and the scheduler with the test plugin set.
|
||||||
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "pre-score-plugin", nil), 2,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "pre-score-plugin", nil), 2,
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
defer testutils.CleanupTest(t, testCtx)
|
||||||
@ -1843,8 +1843,8 @@ func TestPreemptWithPermitPlugin(t *testing.T) {
|
|||||||
permitPlugin := &PermitPlugin{}
|
permitPlugin := &PermitPlugin{}
|
||||||
registry, prof := initRegistryAndConfig(t, permitPlugin)
|
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.
|
||||||
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestMaster(t, "preempt-with-permit-plugin", nil), 0,
|
testCtx := initTestSchedulerForFrameworkTest(t, testutils.InitTestAPIServer(t, "preempt-with-permit-plugin", nil), 0,
|
||||||
scheduler.WithProfiles(prof),
|
scheduler.WithProfiles(prof),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
||||||
defer testutils.CleanupTest(t, testCtx)
|
defer testutils.CleanupTest(t, testCtx)
|
||||||
|
@ -153,7 +153,7 @@ func TestPreemption(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
testCtx := testutils.InitTestSchedulerWithOptions(t,
|
testCtx := testutils.InitTestSchedulerWithOptions(t,
|
||||||
testutils.InitTestMaster(t, "preemption", nil),
|
testutils.InitTestAPIServer(t, "preemption", nil),
|
||||||
nil,
|
nil,
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithFrameworkOutOfTreeRegistry(registry))
|
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.
|
// This test verifies that system critical priorities are created automatically and resolved properly.
|
||||||
func TestPodPriorityResolution(t *testing.T) {
|
func TestPodPriorityResolution(t *testing.T) {
|
||||||
admission := priority.NewPlugin()
|
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)
|
defer testutils.CleanupTest(t, testCtx)
|
||||||
cs := testCtx.ClientSet
|
cs := testCtx.ClientSet
|
||||||
|
|
||||||
@ -1321,7 +1321,7 @@ func TestPDBInPreemption(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initTestPreferNominatedNode(t *testing.T, nsPrefix string, opts ...scheduler.Option) *testutils.TestContext {
|
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)
|
testutils.SyncInformerFactory(testCtx)
|
||||||
// wraps the NextPod() method to make it appear the preemption has been done already and the nominated node has been set.
|
// 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
|
f := testCtx.Scheduler.NextPod
|
||||||
|
@ -62,7 +62,7 @@ func initTestSchedulerForPriorityTest(t *testing.T, scorePluginName string) *tes
|
|||||||
})
|
})
|
||||||
testCtx := testutils.InitTestSchedulerWithOptions(
|
testCtx := testutils.InitTestSchedulerWithOptions(
|
||||||
t,
|
t,
|
||||||
testutils.InitTestMaster(t, strings.ToLower(scorePluginName), nil),
|
testutils.InitTestAPIServer(t, strings.ToLower(scorePluginName), nil),
|
||||||
nil,
|
nil,
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
)
|
)
|
||||||
|
@ -81,7 +81,7 @@ func TestServiceAffinityEnqueue(t *testing.T) {
|
|||||||
// Use zero backoff seconds to bypass backoffQ.
|
// Use zero backoff seconds to bypass backoffQ.
|
||||||
testCtx := testutils.InitTestSchedulerWithOptions(
|
testCtx := testutils.InitTestSchedulerWithOptions(
|
||||||
t,
|
t,
|
||||||
testutils.InitTestMaster(t, "serviceaffinity-enqueue", nil),
|
testutils.InitTestAPIServer(t, "serviceaffinity-enqueue", nil),
|
||||||
nil,
|
nil,
|
||||||
scheduler.WithProfiles(cfg.Profiles...),
|
scheduler.WithProfiles(cfg.Profiles...),
|
||||||
scheduler.WithPodInitialBackoffSeconds(0),
|
scheduler.WithPodInitialBackoffSeconds(0),
|
||||||
|
@ -63,7 +63,7 @@ func TestTaintNodeByCondition(t *testing.T) {
|
|||||||
// Build PodToleration Admission.
|
// Build PodToleration Admission.
|
||||||
admission := podtolerationrestriction.NewPodTolerationsPlugin(&pluginapi.Configuration{})
|
admission := podtolerationrestriction.NewPodTolerationsPlugin(&pluginapi.Configuration{})
|
||||||
|
|
||||||
testCtx := testutils.InitTestMaster(t, "default", admission)
|
testCtx := testutils.InitTestAPIServer(t, "default", admission)
|
||||||
|
|
||||||
// Build clientset and informers for controllers.
|
// Build clientset and informers for controllers.
|
||||||
externalClientset := kubernetes.NewForConfigOrDie(&restclient.Config{
|
externalClientset := kubernetes.NewForConfigOrDie(&restclient.Config{
|
||||||
|
@ -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
|
// 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, opts...)
|
testCtx := testutils.InitTestSchedulerWithOptions(t, testutils.InitTestAPIServer(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
|
||||||
@ -105,7 +105,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.InitTestAPIServer(t, nsPrefix, nil), nil,
|
||||||
scheduler.WithProfiles(cfg.Profiles...))
|
scheduler.WithProfiles(cfg.Profiles...))
|
||||||
testutils.SyncInformerFactory(testCtx)
|
testutils.SyncInformerFactory(testCtx)
|
||||||
go testCtx.Scheduler.Run(testCtx.Ctx)
|
go testCtx.Scheduler.Run(testCtx.Ctx)
|
||||||
|
@ -319,16 +319,16 @@ func UpdateNodeStatus(cs clientset.Interface, node *v1.Node) error {
|
|||||||
return err
|
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.
|
// 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())
|
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||||
testCtx := TestContext{
|
testCtx := TestContext{
|
||||||
Ctx: ctx,
|
Ctx: ctx,
|
||||||
CancelFn: cancelFunc,
|
CancelFn: cancelFunc,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Create control plane
|
// 1. Create API server
|
||||||
h := &framework.APIServerHolder{Initialized: make(chan struct{})}
|
h := &framework.APIServerHolder{Initialized: make(chan struct{})}
|
||||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
<-h.Initialized
|
<-h.Initialized
|
||||||
|
@ -54,10 +54,10 @@ type testContext struct {
|
|||||||
cancelFn context.CancelFunc
|
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
|
// configuration. Alpha resources are enabled automatically if the corresponding feature
|
||||||
// is enabled.
|
// 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())
|
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||||
testCtx := testContext{
|
testCtx := testContext{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
|
@ -1006,7 +1006,7 @@ func TestRescheduleProvisioning(t *testing.T) {
|
|||||||
// Set feature gates
|
// Set feature gates
|
||||||
controllerCh := make(chan struct{})
|
controllerCh := make(chan struct{})
|
||||||
|
|
||||||
testCtx := initTestMaster(t, "reschedule-volume-provision", nil)
|
testCtx := initTestAPIServer(t, "reschedule-volume-provision", nil)
|
||||||
|
|
||||||
clientset := testCtx.clientSet
|
clientset := testCtx.clientSet
|
||||||
ns := testCtx.ns.Name
|
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 {
|
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
|
clientset := textCtx.clientSet
|
||||||
ns := textCtx.ns.Name
|
ns := textCtx.ns.Name
|
||||||
|
|
||||||
|
@ -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 {
|
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
|
clientset := textCtx.clientSet
|
||||||
ns := textCtx.ns.Name
|
ns := textCtx.ns.Name
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user