Commit 71df8f65 authored by Michail Kargakis's avatar Michail Kargakis

test: wait for complete rollouts in WaitForDeploymentStatusValid

parent 57a47b6a
...@@ -1134,10 +1134,12 @@ func testScaledRolloutDeployment(f *framework.Framework) { ...@@ -1134,10 +1134,12 @@ func testScaledRolloutDeployment(f *framework.Framework) {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
firstCond := client.ReplicaSetHasDesiredReplicas(c.Extensions(), first) firstCond := client.ReplicaSetHasDesiredReplicas(c.Extensions(), first)
wait.PollImmediate(10*time.Millisecond, 1*time.Minute, firstCond) err = wait.PollImmediate(10*time.Millisecond, 1*time.Minute, firstCond)
Expect(err).NotTo(HaveOccurred())
secondCond := client.ReplicaSetHasDesiredReplicas(c.Extensions(), second) secondCond := client.ReplicaSetHasDesiredReplicas(c.Extensions(), second)
wait.PollImmediate(10*time.Millisecond, 1*time.Minute, secondCond) err = wait.PollImmediate(10*time.Millisecond, 1*time.Minute, secondCond)
Expect(err).NotTo(HaveOccurred())
By(fmt.Sprintf("Updating the size (up) and template at the same time for deployment %q", deploymentName)) By(fmt.Sprintf("Updating the size (up) and template at the same time for deployment %q", deploymentName))
newReplicas := int32(20) newReplicas := int32(20)
...@@ -1193,10 +1195,12 @@ func testScaledRolloutDeployment(f *framework.Framework) { ...@@ -1193,10 +1195,12 @@ func testScaledRolloutDeployment(f *framework.Framework) {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
oldCond := client.ReplicaSetHasDesiredReplicas(c.Extensions(), oldRs) oldCond := client.ReplicaSetHasDesiredReplicas(c.Extensions(), oldRs)
wait.PollImmediate(10*time.Millisecond, 1*time.Minute, oldCond) err = wait.PollImmediate(10*time.Millisecond, 1*time.Minute, oldCond)
Expect(err).NotTo(HaveOccurred())
newCond := client.ReplicaSetHasDesiredReplicas(c.Extensions(), newRs) newCond := client.ReplicaSetHasDesiredReplicas(c.Extensions(), newRs)
wait.PollImmediate(10*time.Millisecond, 1*time.Minute, newCond) err = wait.PollImmediate(10*time.Millisecond, 1*time.Minute, newCond)
Expect(err).NotTo(HaveOccurred())
By(fmt.Sprintf("Updating the size (down) and template at the same time for deployment %q", deploymentName)) By(fmt.Sprintf("Updating the size (down) and template at the same time for deployment %q", deploymentName))
newReplicas = int32(5) newReplicas = int32(5)
......
...@@ -2896,7 +2896,18 @@ func WaitForDeploymentStatusValid(c clientset.Interface, d *extensions.Deploymen ...@@ -2896,7 +2896,18 @@ func WaitForDeploymentStatusValid(c clientset.Interface, d *extensions.Deploymen
Logf(reason) Logf(reason)
return false, nil return false, nil
} }
return true, nil
// When the deployment status and its underlying resources reach the desired state, we're done
if deployment.Status.Replicas == deployment.Spec.Replicas &&
deployment.Status.UpdatedReplicas == deployment.Spec.Replicas &&
deployment.Status.AvailableReplicas == deployment.Spec.Replicas {
return true, nil
}
reason = fmt.Sprintf("deployment status: %#v", deployment.Status)
Logf(reason)
return false, nil
}) })
if err == wait.ErrWaitTimeout { if err == wait.ErrWaitTimeout {
...@@ -2960,9 +2971,7 @@ func WaitForDeploymentStatus(c clientset.Interface, d *extensions.Deployment) er ...@@ -2960,9 +2971,7 @@ func WaitForDeploymentStatus(c clientset.Interface, d *extensions.Deployment) er
// When the deployment status and its underlying resources reach the desired state, we're done // When the deployment status and its underlying resources reach the desired state, we're done
if deployment.Status.Replicas == deployment.Spec.Replicas && if deployment.Status.Replicas == deployment.Spec.Replicas &&
deployment.Status.UpdatedReplicas == deployment.Spec.Replicas && deployment.Status.UpdatedReplicas == deployment.Spec.Replicas {
deploymentutil.GetReplicaCountForReplicaSets(oldRSs) == 0 &&
deploymentutil.GetReplicaCountForReplicaSets([]*extensions.ReplicaSet{newRS}) == deployment.Spec.Replicas {
return true, nil return true, nil
} }
return false, nil return false, nil
......
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