mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-30 21:30:16 +00:00 
			
		
		
		
	pkg/controller/deployment: syncRolloutStatus additional unit test case
Added additional test case that exercises fix #53614 or npe when scaling --replicas=0 Moved creation of clientset and deployment controller objects inside test loop since it's mutated every time an API action happens. Signed-off-by: John Kelly <jekohk@gmail.com>
This commit is contained in:
		| @@ -279,6 +279,14 @@ func TestSyncRolloutStatus(t *testing.T) { | ||||
| 			conditionStatus: v1.ConditionTrue, | ||||
| 			conditionReason: util.NewRSAvailableReason, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:            "DeploymentComplete: defend against NPE when newRS=nil", | ||||
| 			d:               currentDeployment(&pds, 0, 3, 3, 3, []extensions.DeploymentCondition{replicaSetUpdated}), | ||||
| 			allRSs:          []*extensions.ReplicaSet{newRSWithAvailable("foo", 0, 0, 0)}, | ||||
| 			conditionType:   extensions.DeploymentProgressing, | ||||
| 			conditionStatus: v1.ConditionTrue, | ||||
| 			conditionReason: util.NewRSAvailableReason, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:            "DeploymentTimedOut: update status if rollout exceeds Progress Deadline", | ||||
| 			d:               currentDeployment(&pds, 3, 2, 2, 2, []extensions.DeploymentCondition{replicaSetUpdated}), | ||||
| @@ -301,12 +309,12 @@ func TestSyncRolloutStatus(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| 	fake := fake.Clientset{} | ||||
| 	dc := &DeploymentController{ | ||||
| 		client: &fake, | ||||
| 	} | ||||
|  | ||||
| 	for _, test := range tests { | ||||
| 		fake := fake.Clientset{} | ||||
| 		dc := &DeploymentController{ | ||||
| 			client: &fake, | ||||
| 		} | ||||
|  | ||||
| 		if test.newRS != nil { | ||||
| 			test.allRSs = append(test.allRSs, test.newRS) | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user