Merged by openshift-bot
OpenShift Bot authored on 2016/09/19 14:11:10... | ... |
@@ -38,6 +38,7 @@ var _ = g.Describe("deploymentconfigs", func() { |
38 | 38 |
minReadySecondsFixture = exutil.FixturePath("testdata", "deployment-min-ready-seconds.yaml") |
39 | 39 |
multipleICTFixture = exutil.FixturePath("testdata", "deployment-example.yaml") |
40 | 40 |
tagImagesFixture = exutil.FixturePath("testdata", "tag-images-deployment.yaml") |
41 |
+ readinessFixture = exutil.FixturePath("testdata", "readiness-test.yaml") |
|
41 | 42 |
) |
42 | 43 |
|
43 | 44 |
g.Describe("when run iteratively", func() { |
... | ... |
@@ -619,6 +620,21 @@ var _ = g.Describe("deploymentconfigs", func() { |
619 | 619 |
}) |
620 | 620 |
}) |
621 | 621 |
|
622 |
+ g.Describe("initially", func() { |
|
623 |
+ g.AfterEach(func() { |
|
624 |
+ failureTrap(oc, "readiness", g.CurrentGinkgoTestDescription().Failed) |
|
625 |
+ }) |
|
626 |
+ |
|
627 |
+ g.It("should not deploy if pods never transition to ready [Conformance]", func() { |
|
628 |
+ _, name, err := createFixture(oc, readinessFixture) |
|
629 |
+ o.Expect(err).NotTo(o.HaveOccurred()) |
|
630 |
+ |
|
631 |
+ g.By("waiting for the deployment to fail") |
|
632 |
+ err = waitForLatestCondition(oc, name, deploymentRunTimeout, deploymentFailed) |
|
633 |
+ o.Expect(err).NotTo(o.HaveOccurred()) |
|
634 |
+ }) |
|
635 |
+ }) |
|
636 |
+ |
|
622 | 637 |
g.Describe("with revision history limits", func() { |
623 | 638 |
g.AfterEach(func() { |
624 | 639 |
failureTrap(oc, "history-limit", g.CurrentGinkgoTestDescription().Failed) |
... | ... |
@@ -189,6 +189,18 @@ func deploymentReachedCompletion(dc *deployapi.DeploymentConfig, rcs []kapi.Repl |
189 | 189 |
return true, nil |
190 | 190 |
} |
191 | 191 |
|
192 |
+func deploymentFailed(dc *deployapi.DeploymentConfig, rcs []kapi.ReplicationController, _ []kapi.Pod) (bool, error) { |
|
193 |
+ if len(rcs) == 0 { |
|
194 |
+ return false, nil |
|
195 |
+ } |
|
196 |
+ rc := rcs[len(rcs)-1] |
|
197 |
+ version := deployutil.DeploymentVersionFor(&rc) |
|
198 |
+ if version != dc.Status.LatestVersion { |
|
199 |
+ return false, nil |
|
200 |
+ } |
|
201 |
+ return deployutil.IsFailedDeployment(&rc), nil |
|
202 |
+} |
|
203 |
+ |
|
192 | 204 |
func deploymentRunning(dc *deployapi.DeploymentConfig, rcs []kapi.ReplicationController, pods []kapi.Pod) (bool, error) { |
193 | 205 |
if len(rcs) == 0 { |
194 | 206 |
return false, nil |
195 | 207 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,27 @@ |
0 |
+apiVersion: v1 |
|
1 |
+kind: DeploymentConfig |
|
2 |
+metadata: |
|
3 |
+ name: readiness |
|
4 |
+spec: |
|
5 |
+ replicas: 1 |
|
6 |
+ strategy: |
|
7 |
+ rollingParams: |
|
8 |
+ timeoutSeconds: 30 |
|
9 |
+ type: Rolling |
|
10 |
+ template: |
|
11 |
+ metadata: |
|
12 |
+ labels: |
|
13 |
+ name: readiness-test |
|
14 |
+ spec: |
|
15 |
+ containers: |
|
16 |
+ - command: |
|
17 |
+ - /bin/sleep |
|
18 |
+ - "10000" |
|
19 |
+ image: docker.io/centos:centos7 |
|
20 |
+ imagePullPolicy: IfNotPresent |
|
21 |
+ name: never-ready |
|
22 |
+ readinessProbe: |
|
23 |
+ exec: |
|
24 |
+ command: |
|
25 |
+ - /bin/false |
|
26 |
+ failureThreshold: 1 |