mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +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
|
||||
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()
|
||||
|
||||
if admission != nil {
|
||||
controlPlaneConfig.GenericConfig.AdmissionControl = admission
|
||||
}
|
||||
|
||||
_, testCtx.HTTPServer, testCtx.CloseFn = framework.RunAnAPIServerUsingServer(controlPlaneConfig, s, h)
|
||||
_, testCtx.HTTPServer, testCtx.CloseFn = framework.RunAnAPIServer(controlPlaneConfig)
|
||||
|
||||
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 {
|
||||
testCtx.NS = framework.CreateTestingNamespace("default", s, t)
|
||||
testCtx.NS = framework.CreateTestingNamespace("default", testCtx.HTTPServer, t)
|
||||
}
|
||||
|
||||
// 2. Create kubeclient
|
||||
kubeConfig := &restclient.Config{
|
||||
QPS: -1, Host: s.URL,
|
||||
QPS: 100,
|
||||
Burst: 100,
|
||||
Host: testCtx.HTTPServer.URL,
|
||||
ContentConfig: restclient.ContentConfig{
|
||||
GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user