Skip to content

Commit 7b905aa

Browse files
committed
Make Deployment's MinReadySeconds test more tollerant to infra
1 parent 65a0b7f commit 7b905aa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/extended/deployments/deployments.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,8 @@ var _ = g.Describe("deploymentconfigs", func() {
907907
// FIXME: remove when tests are migrated to the new client
908908
// (the old one incorrectly translates nil into an empty array)
909909
dc.Spec.Triggers = append(dc.Spec.Triggers, deployapi.DeploymentTriggerPolicy{Type: deployapi.DeploymentTriggerOnConfigChange})
910+
// This is the last place we can safely say that the time was taken before replicas became ready
911+
startTime := time.Now()
910912
dc, err = oc.Client().DeploymentConfigs(namespace).Create(dc)
911913
o.Expect(err).NotTo(o.HaveOccurred())
912914

@@ -937,7 +939,7 @@ var _ = g.Describe("deploymentconfigs", func() {
937939

938940
g.By("waiting for the deployment to finish")
939941
rc1, err = waitForRCModification(oc, namespace, rc1.Name,
940-
deploymentChangeTimeout+time.Duration(dc.Spec.MinReadySeconds)*time.Second,
942+
deploymentRunTimeout+time.Duration(dc.Spec.MinReadySeconds)*time.Second,
941943
rc1.GetResourceVersion(), func(rc *kapiv1.ReplicationController) (bool, error) {
942944
if rc.Status.AvailableReplicas == dc.Spec.Replicas {
943945
return true, nil
@@ -952,6 +954,8 @@ var _ = g.Describe("deploymentconfigs", func() {
952954
// We need to log here to have a timestamp to compare with master logs if something goes wrong
953955
e2e.Logf("Finished waiting for deployment.")
954956
o.Expect(err).NotTo(o.HaveOccurred())
957+
o.Expect(time.Since(startTime)).To(o.BeNumerically(">=", time.Duration(dc.Spec.MinReadySeconds)*time.Second),
958+
"Deployment shall not finish before MinReadySeconds elapse.")
955959
o.Expect(rc1.Status.AvailableReplicas).To(o.Equal(dc.Spec.Replicas))
956960
// Deployment status can't be updated yet but should be right after
957961
o.Expect(deployutil.DeploymentStatusFor(rc1)).To(o.Equal(deployapi.DeploymentStatusRunning))

0 commit comments

Comments
 (0)