Skip to content

Commit

Permalink
Merge pull request #16061 from tnozicka/make-deployments-minreadyseco…
Browse files Browse the repository at this point in the history
…nds-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.
  • Loading branch information
openshift-merge-robot authored Aug 31, 2017
2 parents 0cdea9b + 7b905aa commit c080c1c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/extended/deployments/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ var _ = g.Describe("deploymentconfigs", func() {
// FIXME: remove when tests are migrated to the new client
// (the old one incorrectly translates nil into an empty array)
dc.Spec.Triggers = append(dc.Spec.Triggers, deployapi.DeploymentTriggerPolicy{Type: deployapi.DeploymentTriggerOnConfigChange})
// This is the last place we can safely say that the time was taken before replicas became ready
startTime := time.Now()
dc, err = oc.Client().DeploymentConfigs(namespace).Create(dc)
o.Expect(err).NotTo(o.HaveOccurred())

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

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

g.By("waiting for the deployment to finish")
rc1, err = waitForRCModification(oc, namespace, rc1.Name,
deploymentChangeTimeout+time.Duration(dc.Spec.MinReadySeconds)*time.Second,
deploymentRunTimeout+time.Duration(dc.Spec.MinReadySeconds)*time.Second,
rc1.GetResourceVersion(), func(rc *kapiv1.ReplicationController) (bool, error) {
if rc.Status.AvailableReplicas == dc.Spec.Replicas {
return true, nil
Expand All @@ -947,7 +951,11 @@ var _ = g.Describe("deploymentconfigs", func() {
}
return false, nil
})
// We need to log here to have a timestamp to compare with master logs if something goes wrong
e2e.Logf("Finished waiting for deployment.")
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(time.Since(startTime)).To(o.BeNumerically(">=", time.Duration(dc.Spec.MinReadySeconds)*time.Second),
"Deployment shall not finish before MinReadySeconds elapse.")
o.Expect(rc1.Status.AvailableReplicas).To(o.Equal(dc.Spec.Replicas))
// Deployment status can't be updated yet but should be right after
o.Expect(deployutil.DeploymentStatusFor(rc1)).To(o.Equal(deployapi.DeploymentStatusRunning))
Expand Down
13 changes: 13 additions & 0 deletions test/extended/deployments/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,19 @@ func failureTrap(oc *exutil.CLI, name string, failed bool) {
e2e.Logf("--- pod %s logs\n%s---\n", pod.Name, out)
}
}

for _, pod := range pods {
if _, ok := pod.Labels[deployapi.DeployerPodForDeploymentLabel]; ok {
continue
}

out, err := oc.Run("get").Args("pod/"+pod.Name, "-o", "yaml").Output()
if err != nil {
e2e.Logf("Error getting pod %s: %v", pod.Name, err)
return
}
e2e.Logf("\n%s\n", out)
}
}

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

0 comments on commit c080c1c

Please sign in to comment.