mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-30 21:30: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.rsLister = append(f.rsLister, rs) | ||||||
| 	f.objects = append(f.objects, foo, rs) | 	f.objects = append(f.objects, foo, rs) | ||||||
|  |  | ||||||
| 	c, informers := f.newController() | 	c, _ := f.newController() | ||||||
| 	enqueued := false | 	enqueued := false | ||||||
| 	c.enqueueDeployment = func(d *extensions.Deployment) { | 	c.enqueueDeployment = func(d *extensions.Deployment) { | ||||||
| 		if d.Name == "foo" { | 		if d.Name == "foo" { | ||||||
| 			enqueued = true | 			enqueued = true | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	stopCh := make(chan struct{}) |  | ||||||
| 	defer close(stopCh) |  | ||||||
| 	informers.Start(stopCh) |  | ||||||
|  |  | ||||||
| 	c.deletePod(pod) | 	c.deletePod(pod) | ||||||
|  |  | ||||||
| @@ -532,16 +529,13 @@ func TestPodDeletionDoesntEnqueueRecreateDeployment(t *testing.T) { | |||||||
| 	// return a non-empty list. | 	// return a non-empty list. | ||||||
| 	f.podLister = append(f.podLister, pod) | 	f.podLister = append(f.podLister, pod) | ||||||
|  |  | ||||||
| 	c, informers := f.newController() | 	c, _ := f.newController() | ||||||
| 	enqueued := false | 	enqueued := false | ||||||
| 	c.enqueueDeployment = func(d *extensions.Deployment) { | 	c.enqueueDeployment = func(d *extensions.Deployment) { | ||||||
| 		if d.Name == "foo" { | 		if d.Name == "foo" { | ||||||
| 			enqueued = true | 			enqueued = true | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	stopCh := make(chan struct{}) |  | ||||||
| 	defer close(stopCh) |  | ||||||
| 	informers.Start(stopCh) |  | ||||||
|  |  | ||||||
| 	c.deletePod(pod) | 	c.deletePod(pod) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user