Fix incorrect reference to deployment in test

pull/6/head
Janet Kuo 2016-08-01 15:26:17 -07:00
parent ed763b8034
commit a82c55213b
2 changed files with 13 additions and 5 deletions

View File

@ -247,6 +247,14 @@ func MaxUnavailable(deployment extensions.Deployment) int32 {
return maxUnavailable
}
// MinAvailable returns the minimum vailable pods of a given deployment
func MinAvailable(deployment *extensions.Deployment) int32 {
if !IsRollingUpdate(deployment) {
return int32(0)
}
return deployment.Spec.Replicas - MaxUnavailable(*deployment)
}
// MaxSurge returns the maximum surge pods a rolling deployment can take.
func MaxSurge(deployment extensions.Deployment) int32 {
if !IsRollingUpdate(&deployment) {

View File

@ -1042,7 +1042,7 @@ func testScaledRolloutDeployment(f *framework.Framework) {
deployment, err = c.Extensions().Deployments(ns).Get(deploymentName)
Expect(err).NotTo(HaveOccurred())
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, d.Spec.Replicas-2))
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, deploymentutil.MinAvailable(deployment)))
err = framework.WaitForDeploymentStatus(c, deployment, true)
Expect(err).NotTo(HaveOccurred())
@ -1063,7 +1063,7 @@ func testScaledRolloutDeployment(f *framework.Framework) {
deployment, err = c.Extensions().Deployments(ns).Get(deploymentName)
Expect(err).NotTo(HaveOccurred())
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, d.Spec.Replicas-2))
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, deploymentutil.MinAvailable(deployment)))
err = framework.WaitForDeploymentStatus(c, deployment, false)
Expect(err).NotTo(HaveOccurred())
@ -1104,7 +1104,7 @@ func testScaledRolloutDeployment(f *framework.Framework) {
Expect(err).NotTo(HaveOccurred())
}
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, d.Spec.Replicas-2))
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, deploymentutil.MinAvailable(deployment)))
err = framework.WaitForDeploymentStatus(c, deployment, true)
Expect(err).NotTo(HaveOccurred())
@ -1122,7 +1122,7 @@ func testScaledRolloutDeployment(f *framework.Framework) {
deployment, err = c.Extensions().Deployments(ns).Get(deploymentName)
Expect(err).NotTo(HaveOccurred())
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, d.Spec.Replicas-2))
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, deploymentutil.MinAvailable(deployment)))
err = framework.WaitForDeploymentStatus(c, deployment, false)
Expect(err).NotTo(HaveOccurred())
@ -1163,7 +1163,7 @@ func testScaledRolloutDeployment(f *framework.Framework) {
Expect(err).NotTo(HaveOccurred())
}
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, d.Spec.Replicas-2))
By(fmt.Sprintf("Waiting for deployment status to sync (current available: %d, minimum available: %d)", deployment.Status.AvailableReplicas, deploymentutil.MinAvailable(deployment)))
err = framework.WaitForDeploymentStatus(c, deployment, true)
Expect(err).NotTo(HaveOccurred())
}