Merge pull request #40673 from kargakis/unit-test-fix

Automatic merge from submit-queue

controller: don't run informers in unit tests when unnecessary

Fixes https://github.com/kubernetes/kubernetes/issues/39908

@mfojtik it seems that using informers makes the deployment sync for the initial relist so this races with the enqueue that these tests are testing.
This commit is contained in:
Kubernetes Submit Queue 2017-01-30 06:44:54 -08:00 committed by GitHub
commit 914402281b

View File

@ -497,16 +497,13 @@ func TestPodDeletionEnqueuesRecreateDeployment(t *testing.T) {
f.rsLister = append(f.rsLister, rs)
f.objects = append(f.objects, foo, rs)
c, informers := f.newController()
c, _ := f.newController()
enqueued := false
c.enqueueDeployment = func(d *extensions.Deployment) {
if d.Name == "foo" {
enqueued = true
}
}
stopCh := make(chan struct{})
defer close(stopCh)
informers.Start(stopCh)
c.deletePod(pod)
@ -532,16 +529,13 @@ func TestPodDeletionDoesntEnqueueRecreateDeployment(t *testing.T) {
// return a non-empty list.
f.podLister = append(f.podLister, pod)
c, informers := f.newController()
c, _ := f.newController()
enqueued := false
c.enqueueDeployment = func(d *extensions.Deployment) {
if d.Name == "foo" {
enqueued = true
}
}
stopCh := make(chan struct{})
defer close(stopCh)
informers.Start(stopCh)
c.deletePod(pod)