Remove duplicate code from test/integration

pull/6/head
Wojciech Tyczynski 2015-10-14 12:11:53 +02:00
parent 4f6ac7ec79
commit 66113539cb
3 changed files with 3 additions and 41 deletions

View File

@ -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"

View File

@ -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()

View File

@ -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"