mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Remove duplicate code from test/integration
This commit is contained in:
		@@ -109,7 +109,7 @@ func TestClient(t *testing.T) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestSingleWatch(t *testing.T) {
 | 
					func TestSingleWatch(t *testing.T) {
 | 
				
			||||||
	_, s := runAMaster(t)
 | 
						_, s := framework.RunAMaster(t)
 | 
				
			||||||
	defer s.Close()
 | 
						defer s.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ns := "blargh"
 | 
						ns := "blargh"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,6 +31,7 @@ import (
 | 
				
			|||||||
	"k8s.io/kubernetes/pkg/labels"
 | 
						"k8s.io/kubernetes/pkg/labels"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/volume"
 | 
						"k8s.io/kubernetes/pkg/volume"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/watch"
 | 
						"k8s.io/kubernetes/pkg/watch"
 | 
				
			||||||
 | 
						"k8s.io/kubernetes/test/integration/framework"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
@@ -38,7 +39,7 @@ func init() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestPersistentVolumeRecycler(t *testing.T) {
 | 
					func TestPersistentVolumeRecycler(t *testing.T) {
 | 
				
			||||||
	_, s := runAMaster(t)
 | 
						_, s := framework.RunAMaster(t)
 | 
				
			||||||
	defer s.Close()
 | 
						defer s.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	deleteAllEtcdKeys()
 | 
						deleteAllEtcdKeys()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,18 +20,7 @@ import (
 | 
				
			|||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io/ioutil"
 | 
						"io/ioutil"
 | 
				
			||||||
	"math/rand"
 | 
						"math/rand"
 | 
				
			||||||
	"net/http"
 | 
					 | 
				
			||||||
	"net/http/httptest"
 | 
					 | 
				
			||||||
	"os"
 | 
						"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/coreos/go-etcd/etcd"
 | 
				
			||||||
	"github.com/golang/glog"
 | 
						"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 {
 | 
					func MakeTempDirOrDie(prefix string, baseDir string) string {
 | 
				
			||||||
	if baseDir == "" {
 | 
						if baseDir == "" {
 | 
				
			||||||
		baseDir = "/tmp"
 | 
							baseDir = "/tmp"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user