From c96109a3212f52cb0b945472dadb54fa25c51214 Mon Sep 17 00:00:00 2001 From: Wei Huang Date: Sun, 8 May 2022 22:28:13 -0700 Subject: [PATCH] Refactor scheduler integration test that starts APIServer in a non-standarized manner --- test/integration/util/util.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/test/integration/util/util.go b/test/integration/util/util.go index f05df65660b..7de4df06bd9 100644 --- a/test/integration/util/util.go +++ b/test/integration/util/util.go @@ -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"}, },