Skip to content

Commit c080c1c

Browse files
Merge pull request #16061 from tnozicka/make-deployments-minreadyseconds-test-more-tolerant-to-infra
Automatic merge from submit-queue Make deployments minreadyseconds test more tolerant to infra Fixes #16025 Will run several test runs here to ses that the flake isn't occurring anymore.
2 parents 0cdea9b + 7b905aa commit c080c1c

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

test/extended/deployments/deployments.go

Lines changed: 9 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

@@ -927,6 +929,8 @@ var _ = g.Describe("deploymentconfigs", func() {
927929
})
928930
o.Expect(err).NotTo(o.HaveOccurred())
929931
o.Expect(rc1.Status.AvailableReplicas).To(o.BeZero())
932+
// We need to log here to have a timestamp to compare with master logs if something goes wrong
933+
e2e.Logf("All replicas are ready.")
930934

931935
g.By("verifying that the deployment is still running")
932936
if deployutil.IsTerminatedDeployment(rc1) {
@@ -935,7 +939,7 @@ var _ = g.Describe("deploymentconfigs", func() {
935939

936940
g.By("waiting for the deployment to finish")
937941
rc1, err = waitForRCModification(oc, namespace, rc1.Name,
938-
deploymentChangeTimeout+time.Duration(dc.Spec.MinReadySeconds)*time.Second,
942+
deploymentRunTimeout+time.Duration(dc.Spec.MinReadySeconds)*time.Second,
939943
rc1.GetResourceVersion(), func(rc *kapiv1.ReplicationController) (bool, error) {
940944
if rc.Status.AvailableReplicas == dc.Spec.Replicas {
941945
return true, nil
@@ -947,7 +951,11 @@ var _ = g.Describe("deploymentconfigs", func() {
947951
}
948952
return false, nil
949953
})
954+
// We need to log here to have a timestamp to compare with master logs if something goes wrong
955+
e2e.Logf("Finished waiting for deployment.")
950956
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.")
951959
o.Expect(rc1.Status.AvailableReplicas).To(o.Equal(dc.Spec.Replicas))
952960
// Deployment status can't be updated yet but should be right after
953961
o.Expect(deployutil.DeploymentStatusFor(rc1)).To(o.Equal(deployapi.DeploymentStatusRunning))

test/extended/deployments/util.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,19 @@ func failureTrap(oc *exutil.CLI, name string, failed bool) {
522522
e2e.Logf("--- pod %s logs\n%s---\n", pod.Name, out)
523523
}
524524
}
525+
526+
for _, pod := range pods {
527+
if _, ok := pod.Labels[deployapi.DeployerPodForDeploymentLabel]; ok {
528+
continue
529+
}
530+
531+
out, err := oc.Run("get").Args("pod/"+pod.Name, "-o", "yaml").Output()
532+
if err != nil {
533+
e2e.Logf("Error getting pod %s: %v", pod.Name, err)
534+
return
535+
}
536+
e2e.Logf("\n%s\n", out)
537+
}
525538
}
526539

527540
func failureTrapForDetachedRCs(oc *exutil.CLI, dcName string, failed bool) {

0 commit comments

Comments
 (0)