Commit a9050679 authored by Alex Mohr's avatar Alex Mohr

Merge pull request #19520 from janetkuo/deployment-expectation-fix

Fix e2e flake: Fix incorrect expectation when deployment scaling down old rcs
parents a5d2c1b0 d693ffaa
...@@ -633,6 +633,7 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl ...@@ -633,6 +633,7 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl
return false, nil return false, nil
} }
totalScaleDownCount := readyPodCount - minAvailable totalScaleDownCount := readyPodCount - minAvailable
totalScaledDown := 0
for _, targetRC := range oldRCs { for _, targetRC := range oldRCs {
if totalScaleDownCount == 0 { if totalScaleDownCount == 0 {
// No further scaling required. // No further scaling required.
...@@ -649,14 +650,16 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl ...@@ -649,14 +650,16 @@ func (dc *DeploymentController) reconcileOldRCs(allRCs []*api.ReplicationControl
if err != nil { if err != nil {
return false, err return false, err
} }
totalScaledDown += scaleDownCount
totalScaleDownCount -= scaleDownCount totalScaleDownCount -= scaleDownCount
dKey, err := controller.KeyFunc(&deployment) }
// Expect to see old rcs scaled down by exactly totalScaledDownCount (sum of scaleDownCount) replicas.
dKey, err = controller.KeyFunc(&deployment)
if err != nil { if err != nil {
return false, fmt.Errorf("Couldn't get key for deployment %#v: %v", deployment, err) return false, fmt.Errorf("Couldn't get key for deployment %#v: %v", deployment, err)
} }
if expectationsCheck { if expectationsCheck {
dc.podExpectations.ExpectDeletions(dKey, scaleDownCount) dc.podExpectations.ExpectDeletions(dKey, totalScaledDown)
}
} }
return true, err return true, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment