plumb stopch to post start hook index since many of them are starting go funcs

This commit is contained in:
deads2k
2017-05-08 11:05:28 -04:00
parent 640373da10
commit be39283923
41 changed files with 254 additions and 224 deletions

View File

@@ -121,9 +121,9 @@ func verifyRemainingObjects(t *testing.T, clientSet clientset.Interface, namespa
return ret, nil
}
func rmSetup(t *testing.T, stopCh chan struct{}) (*httptest.Server, *replication.ReplicationManager, informers.SharedInformerFactory, clientset.Interface) {
func rmSetup(t *testing.T, stopCh chan struct{}) (*httptest.Server, framework.CloseFunc, *replication.ReplicationManager, informers.SharedInformerFactory, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
_, s := framework.RunAMaster(masterConfig)
_, s, closeFn := framework.RunAMaster(masterConfig)
config := restclient.Config{Host: s.URL}
clientSet, err := clientset.NewForConfig(&config)
@@ -136,7 +136,7 @@ func rmSetup(t *testing.T, stopCh chan struct{}) (*httptest.Server, *replication
rm := replication.NewReplicationManager(informers.Core().V1().Pods(), informers.Core().V1().ReplicationControllers(), clientSet, replication.BurstReplicas)
informers.Start(stopCh)
return s, rm, informers, clientSet
return s, closeFn, rm, informers, clientSet
}
// wait for the podInformer to observe the pods. Call this function before
@@ -207,7 +207,8 @@ func TestAdoption(t *testing.T) {
}
for i, tc := range testCases {
stopCh := make(chan struct{})
s, rm, informers, clientSet := rmSetup(t, stopCh)
s, closeFn, rm, informers, clientSet := rmSetup(t, stopCh)
defer closeFn()
ns := framework.CreateTestingNamespace(fmt.Sprintf("adoption-%d", i), s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
@@ -284,7 +285,8 @@ func TestUpdateSelectorToAdopt(t *testing.T) {
// matches pod1 only; change the selector to match pod2 as well. Verify
// there is only one pod left.
stopCh := make(chan struct{})
s, rm, _, clientSet := rmSetup(t, stopCh)
s, closeFn, rm, _, clientSet := rmSetup(t, stopCh)
defer closeFn()
ns := framework.CreateTestingNamespace("update-selector-to-adopt", s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
rc := newRC("rc", ns.Name, 1)
@@ -323,7 +325,8 @@ func TestUpdateSelectorToRemoveControllerRef(t *testing.T) {
// that rc creates one more pod, so there are 3 pods. Also verify that
// pod2's controllerRef is cleared.
stopCh := make(chan struct{})
s, rm, informers, clientSet := rmSetup(t, stopCh)
s, closeFn, rm, informers, clientSet := rmSetup(t, stopCh)
defer closeFn()
ns := framework.CreateTestingNamespace("update-selector-to-remove-controllerref", s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
rc := newRC("rc", ns.Name, 2)
@@ -368,7 +371,8 @@ func TestUpdateLabelToRemoveControllerRef(t *testing.T) {
// that rc creates one more pod, so there are 3 pods. Also verify that
// pod2's controllerRef is cleared.
stopCh := make(chan struct{})
s, rm, _, clientSet := rmSetup(t, stopCh)
s, closeFn, rm, _, clientSet := rmSetup(t, stopCh)
defer closeFn()
ns := framework.CreateTestingNamespace("update-label-to-remove-controllerref", s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
rc := newRC("rc", ns.Name, 2)
@@ -409,7 +413,8 @@ func TestUpdateLabelToBeAdopted(t *testing.T) {
// controller adopts pod2 and delete one of them, so there is only 1 pod
// left.
stopCh := make(chan struct{})
s, rm, _, clientSet := rmSetup(t, stopCh)
s, closeFn, rm, _, clientSet := rmSetup(t, stopCh)
defer closeFn()
ns := framework.CreateTestingNamespace("update-label-to-be-adopted", s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
rc := newRC("rc", ns.Name, 1)