mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #15614 from wojtek-t/cleanup_integration_utils
Auto commit by PR queue bot
This commit is contained in:
commit
979ca2b3fe
@ -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"
|
||||||
|
Loading…
Reference in New Issue
Block a user