Enable Garbage collection by default for RS and RC

This commit is contained in:
Mayank Kumar
2017-02-09 16:02:23 -08:00
parent 8e13ee01d6
commit 6b35ff72ce
10 changed files with 110 additions and 143 deletions

View File

@@ -123,7 +123,7 @@ func verifyRemainingObjects(t *testing.T, clientSet clientset.Interface, namespa
return ret, nil
}
func rmSetup(t *testing.T, stopCh chan struct{}, enableGarbageCollector bool) (*httptest.Server, *replication.ReplicationManager, informers.SharedInformerFactory, clientset.Interface) {
func rmSetup(t *testing.T, stopCh chan struct{}) (*httptest.Server, *replication.ReplicationManager, informers.SharedInformerFactory, clientset.Interface) {
masterConfig := framework.NewIntegrationTestMasterConfig()
_, s := framework.RunAMaster(masterConfig)
@@ -135,7 +135,7 @@ func rmSetup(t *testing.T, stopCh chan struct{}, enableGarbageCollector bool) (*
resyncPeriod := 12 * time.Hour
informers := informers.NewSharedInformerFactory(clientSet, resyncPeriod)
rm := replication.NewReplicationManager(informers.Core().V1().Pods(), informers.Core().V1().ReplicationControllers(), clientSet, replication.BurstReplicas, 4096, enableGarbageCollector)
rm := replication.NewReplicationManager(informers.Core().V1().Pods(), informers.Core().V1().ReplicationControllers(), clientSet, replication.BurstReplicas, 4096)
informers.Start(stopCh)
return s, rm, informers, clientSet
@@ -209,7 +209,7 @@ func TestAdoption(t *testing.T) {
}
for i, tc := range testCases {
stopCh := make(chan struct{})
s, rm, informers, clientSet := rmSetup(t, stopCh, true)
s, rm, informers, clientSet := rmSetup(t, stopCh)
ns := framework.CreateTestingNamespace(fmt.Sprintf("adoption-%d", i), s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
@@ -286,7 +286,7 @@ 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, true)
s, rm, _, clientSet := rmSetup(t, stopCh)
ns := framework.CreateTestingNamespace("update-selector-to-adopt", s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
rc := newRC("rc", ns.Name, 1)
@@ -325,7 +325,7 @@ 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, true)
s, rm, informers, clientSet := rmSetup(t, stopCh)
ns := framework.CreateTestingNamespace("update-selector-to-remove-controllerref", s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
rc := newRC("rc", ns.Name, 2)
@@ -370,7 +370,7 @@ 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, true)
s, rm, _, clientSet := rmSetup(t, stopCh)
ns := framework.CreateTestingNamespace("update-label-to-remove-controllerref", s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
rc := newRC("rc", ns.Name, 2)
@@ -411,7 +411,7 @@ 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, true)
s, rm, _, clientSet := rmSetup(t, stopCh)
ns := framework.CreateTestingNamespace("update-label-to-be-adopted", s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
rc := newRC("rc", ns.Name, 1)