Cleanup integration RunAMaster

pull/6/head
Wojciech Tyczynski 2016-07-04 15:16:13 +02:00
parent 11211a49e3
commit bee29b59d2
11 changed files with 38 additions and 47 deletions

View File

@ -44,7 +44,7 @@ import (
)
func TestClient(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
client := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
@ -116,7 +116,7 @@ func TestClient(t *testing.T) {
}
func TestAtomicPut(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
c := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
@ -208,7 +208,7 @@ func TestAtomicPut(t *testing.T) {
}
func TestPatch(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
c := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
@ -317,7 +317,7 @@ func TestPatch(t *testing.T) {
}
func TestPatchWithCreateOnUpdate(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
c := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
@ -428,7 +428,7 @@ func TestPatchWithCreateOnUpdate(t *testing.T) {
}
func TestAPIVersions(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
c := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
@ -450,7 +450,7 @@ func TestAPIVersions(t *testing.T) {
}
func TestSingleWatch(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
ns := framework.CreateTestingNamespace("single-watch", s, t)
@ -535,7 +535,7 @@ func TestMultiWatch(t *testing.T) {
const watcherCount = 50
rt.GOMAXPROCS(watcherCount)
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
ns := framework.CreateTestingNamespace("multi-watch", s, t)
@ -794,7 +794,7 @@ func TestSelfLinkOnNamespace(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
c := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})

View File

@ -32,7 +32,7 @@ import (
// TestConfigMap tests apiserver-side behavior of creation of ConfigMaps and pods that consume them.
func TestConfigMap(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
client := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})

View File

@ -37,7 +37,7 @@ func TestDynamicClient(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
gv := testapi.Default.GroupVersion()

View File

@ -188,7 +188,7 @@ func TestSchedulerExtender(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
restClient := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})

View File

@ -347,21 +347,12 @@ func StartPods(numPods int, host string, restClient *client.Client) error {
}
}
// TODO: Merge this into startMasterOrDie.
func RunAMaster(t *testing.T) (*master.Master, *httptest.Server) {
masterConfig := NewMasterConfig()
masterConfig.EnableProfiling = true
m, err := master.New(masterConfig)
if err != nil {
// TODO: Return error.
glog.Fatalf("error in bringing up the master: %v", err)
func RunAMaster(masterConfig *master.Config) (*master.Master, *httptest.Server) {
if masterConfig == nil {
masterConfig = NewMasterConfig()
masterConfig.EnableProfiling = true
}
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
m.Handler.ServeHTTP(w, req)
}))
return m, s
return startMasterOrDie(masterConfig)
}
// Task is a function passed to worker goroutines by RunParallel.

View File

@ -42,7 +42,7 @@ import (
)
func testPrefix(t *testing.T, prefix string) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
resp, err := http.Get(s.URL + prefix)
@ -71,7 +71,7 @@ func TestExtensionsPrefix(t *testing.T) {
}
func TestWatchSucceedsWithoutArgs(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
resp, err := http.Get(s.URL + "/api/v1/namespaces?watch=1")
@ -118,7 +118,7 @@ func extensionsPath(resource, namespace, name string) string {
}
func TestAutoscalingGroupBackwardCompatibility(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
transport := http.DefaultTransport
@ -261,7 +261,7 @@ func TestBatchGroupBackwardCompatibility(t *testing.T) {
if *testapi.Batch.GroupVersion() == v2alpha1.SchemeGroupVersion {
t.Skip("Shared job storage is not required for batch/v2alpha1.")
}
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
transport := http.DefaultTransport
@ -314,7 +314,7 @@ func TestBatchGroupBackwardCompatibility(t *testing.T) {
}
func TestAccept(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
resp, err := http.Get(s.URL + "/api/")

View File

@ -86,7 +86,7 @@ func checkForExpectedMetrics(t *testing.T, metrics []*prometheuspb.MetricFamily,
}
func TestMasterProcessMetrics(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
metrics, err := scrapeMetrics(s)
@ -103,7 +103,7 @@ func TestMasterProcessMetrics(t *testing.T) {
}
func TestApiserverMetrics(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
// Make a request to the apiserver to ensure there's at least one data point

View File

@ -108,7 +108,7 @@ func TestPersistentVolumeRecycler(t *testing.T) {
framework.DeleteAllEtcdKeys()
glog.V(2).Infof("TestPersistentVolumeRecycler started")
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
testClient, ctrl, watchPV, watchPVC := createClients(t, s)
@ -158,7 +158,7 @@ func TestPersistentVolumeDeleter(t *testing.T) {
framework.DeleteAllEtcdKeys()
glog.V(2).Infof("TestPersistentVolumeDeleter started")
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
testClient, ctrl, watchPV, watchPVC := createClients(t, s)
@ -212,7 +212,7 @@ func TestPersistentVolumeBindRace(t *testing.T) {
// Test a race binding many claims to a PV that is pre-bound to a specific
// PVC. Only this specific PVC should get bound.
glog.V(2).Infof("TestPersistentVolumeBindRace started")
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
testClient, ctrl, watchPV, watchPVC := createClients(t, s)
@ -279,7 +279,7 @@ func TestPersistentVolumeClaimLabelSelector(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
testClient, controller, watchPV, watchPVC := createClients(t, s)
@ -354,7 +354,7 @@ func TestPersistentVolumeClaimLabelSelectorMatchExpressions(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
testClient, controller, watchPV, watchPVC := createClients(t, s)
@ -448,7 +448,7 @@ func TestPersistentVolumeMultiPVs(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
testClient, controller, watchPV, watchPVC := createClients(t, s)
@ -532,7 +532,7 @@ func TestPersistentVolumeMultiPVsPVCs(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
testClient, binder, watchPV, watchPVC := createClients(t, s)
@ -613,7 +613,7 @@ func TestPersistentVolumeProvisionMultiPVCs(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
testClient, binder, watchPV, watchPVC := createClients(t, s)
@ -692,7 +692,7 @@ func TestPersistentVolumeMultiPVsDiffAccessModes(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
testClient, controller, watchPV, watchPVC := createClients(t, s)

View File

@ -30,7 +30,7 @@ import (
)
func TestPodUpdateActiveDeadlineSeconds(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
ns := framework.CreateTestingNamespace("pod-activedeadline-update", s, t)
@ -147,7 +147,7 @@ func TestPodUpdateActiveDeadlineSeconds(t *testing.T) {
}
func TestPodReadOnlyFilesystem(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
isReadOnly := true

View File

@ -53,7 +53,7 @@ func TestUnschedulableNodes(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
restClient := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
@ -292,7 +292,7 @@ func TestMultiScheduler(t *testing.T) {
// TODO: Limit the test to a single non-default namespace and clean this up at the end.
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
// TODO: Uncomment when fix #19254
// This seems to be a different issue - it still doesn't work.
// defer s.Close()
@ -473,7 +473,7 @@ func createPod(client *client.Client, name string, annotation map[string]string)
func TestAllocatable(t *testing.T) {
framework.DeleteAllEtcdKeys()
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
// 1. create and start default-scheduler

View File

@ -38,7 +38,7 @@ func deleteSecretOrErrorf(t *testing.T, c *client.Client, ns, name string) {
// TestSecrets tests apiserver-side behavior of creation of secret objects and their use by pods.
func TestSecrets(t *testing.T) {
_, s := framework.RunAMaster(t)
_, s := framework.RunAMaster(nil)
defer s.Close()
client := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})