mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +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) {
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, test := range tests {
 | 
			
		||||
		fake := fake.Clientset{}
 | 
			
		||||
		dc := &DeploymentController{
 | 
			
		||||
			client: &fake,
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	for _, test := range tests {
 | 
			
		||||
		if test.newRS != nil {
 | 
			
		||||
			test.allRSs = append(test.allRSs, test.newRS)
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user