From 66113539cbf77030e9bf438d8d8c7ab8905399cc Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Wed, 14 Oct 2015 12:11:53 +0200 Subject: [PATCH] Remove duplicate code from test/integration --- test/integration/client_test.go | 2 +- test/integration/persistent_volumes_test.go | 3 +- test/integration/utils.go | 39 --------------------- 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/test/integration/client_test.go b/test/integration/client_test.go index be81d68ee34..02916c230b9 100644 --- a/test/integration/client_test.go +++ b/test/integration/client_test.go @@ -109,7 +109,7 @@ func TestClient(t *testing.T) { } func TestSingleWatch(t *testing.T) { - _, s := runAMaster(t) + _, s := framework.RunAMaster(t) defer s.Close() ns := "blargh" diff --git a/test/integration/persistent_volumes_test.go b/test/integration/persistent_volumes_test.go index cf157cad7e2..c4eb6250567 100644 --- a/test/integration/persistent_volumes_test.go +++ b/test/integration/persistent_volumes_test.go @@ -31,6 +31,7 @@ import ( "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/watch" + "k8s.io/kubernetes/test/integration/framework" ) func init() { @@ -38,7 +39,7 @@ func init() { } func TestPersistentVolumeRecycler(t *testing.T) { - _, s := runAMaster(t) + _, s := framework.RunAMaster(t) defer s.Close() deleteAllEtcdKeys() diff --git a/test/integration/utils.go b/test/integration/utils.go index de7e38c7edd..002d23bbf2e 100644 --- a/test/integration/utils.go +++ b/test/integration/utils.go @@ -20,18 +20,7 @@ import ( "fmt" "io/ioutil" "math/rand" - "net/http" - "net/http/httptest" "os" - "testing" - - "k8s.io/kubernetes/pkg/api/latest" - "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/apiserver" - client "k8s.io/kubernetes/pkg/client/unversioned" - "k8s.io/kubernetes/pkg/master" - "k8s.io/kubernetes/pkg/tools/etcdtest" - "k8s.io/kubernetes/plugin/pkg/admission/admit" "github.com/coreos/go-etcd/etcd" "github.com/golang/glog" @@ -67,34 +56,6 @@ func deleteAllEtcdKeys() { } -func runAMaster(t *testing.T) (*master.Master, *httptest.Server) { - etcdStorage, err := master.NewEtcdStorage(newEtcdClient(), latest.GroupOrDie("").InterfacesFor, testapi.Default.Version(), etcdtest.PathPrefix()) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - storageDestinations := master.NewStorageDestinations() - storageDestinations.AddAPIGroup("", etcdStorage) - - m := master.New(&master.Config{ - StorageDestinations: storageDestinations, - KubeletClient: client.FakeKubeletClient{}, - EnableCoreControllers: true, - EnableLogsSupport: false, - EnableProfiling: true, - EnableUISupport: false, - APIPrefix: "/api", - Authorizer: apiserver.NewAlwaysAllowAuthorizer(), - AdmissionControl: admit.NewAlwaysAdmit(), - StorageVersions: map[string]string{"": testapi.Default.Version()}, - }) - - s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - m.Handler.ServeHTTP(w, req) - })) - - return m, s -} - func MakeTempDirOrDie(prefix string, baseDir string) string { if baseDir == "" { baseDir = "/tmp"