mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	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:
		@@ -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)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user