mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
Refactor scheduler integration test that starts APIServer in a non-standarized manner
This commit is contained in:
parent
bf52c1fd46
commit
c96109a321
@ -350,29 +350,25 @@ func InitTestAPIServer(t *testing.T, nsPrefix string, admission admission.Interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1. Create API server
|
// 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
|
|
||||||
h.M.GenericAPIServer.Handler.ServeHTTP(w, req)
|
|
||||||
}))
|
|
||||||
|
|
||||||
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
|
|
||||||
if admission != nil {
|
if admission != nil {
|
||||||
controlPlaneConfig.GenericConfig.AdmissionControl = admission
|
controlPlaneConfig.GenericConfig.AdmissionControl = admission
|
||||||
}
|
}
|
||||||
|
|
||||||
_, testCtx.HTTPServer, testCtx.CloseFn = framework.RunAnAPIServerUsingServer(controlPlaneConfig, s, h)
|
_, testCtx.HTTPServer, testCtx.CloseFn = framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
if nsPrefix != "default" {
|
if nsPrefix != "default" {
|
||||||
testCtx.NS = framework.CreateTestingNamespace(nsPrefix+string(uuid.NewUUID()), s, t)
|
testCtx.NS = framework.CreateTestingNamespace(nsPrefix+string(uuid.NewUUID()), testCtx.HTTPServer, t)
|
||||||
} else {
|
} else {
|
||||||
testCtx.NS = framework.CreateTestingNamespace("default", s, t)
|
testCtx.NS = framework.CreateTestingNamespace("default", testCtx.HTTPServer, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Create kubeclient
|
// 2. Create kubeclient
|
||||||
kubeConfig := &restclient.Config{
|
kubeConfig := &restclient.Config{
|
||||||
QPS: -1, Host: s.URL,
|
QPS: 100,
|
||||||
|
Burst: 100,
|
||||||
|
Host: testCtx.HTTPServer.URL,
|
||||||
ContentConfig: restclient.ContentConfig{
|
ContentConfig: restclient.ContentConfig{
|
||||||
GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"},
|
GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user