@@ -33,20 +33,20 @@ var _ = g.Describe("deploymentconfigs", func() {
33
33
)
34
34
35
35
g .Describe ("when run iteratively" , func () {
36
- g .It ("should only deploy the last deployment [Conformance]" , func () {
37
- // print some debugging output if the deploymeent fails
38
- defer func () {
39
- if ! g .CurrentGinkgoTestDescription ().Failed {
40
- return
41
- }
42
- if dc , rcs , pods , err := deploymentInfo (oc , "deployment-simple" ); err == nil {
43
- e2e .Logf ("DC: %#v" , dc )
44
- e2e .Logf (" RCs: %#v" , rcs )
45
- p , _ := deploymentPods (pods )
46
- e2e .Logf (" Deployers: %#v" , p )
47
- }
48
- }()
36
+ g .AfterEach (func () {
37
+ if ! g .CurrentGinkgoTestDescription ().Failed {
38
+ return
39
+ }
40
+
41
+ if dc , rcs , pods , err := deploymentInfo (oc , "deployment-simple" ); err == nil {
42
+ e2e .Logf ("DC: %#v" , dc )
43
+ e2e .Logf (" RCs: %#v" , rcs )
44
+ p , _ := deploymentPods (pods )
45
+ e2e .Logf (" Deployers: %#v" , p )
46
+ }
47
+ })
49
48
49
+ g .It ("should only deploy the last deployment [Conformance]" , func () {
50
50
_ , err := oc .Run ("create" ).Args ("-f" , simpleDeploymentFixture ).Output ()
51
51
o .Expect (err ).NotTo (o .HaveOccurred ())
52
52
@@ -132,24 +132,29 @@ var _ = g.Describe("deploymentconfigs", func() {
132
132
})
133
133
134
134
g .It ("should immediately start a new deployment [Conformance]" , func () {
135
- resource , name , err := createFixture (oc , generationFixture )
135
+ resource , name , err := createFixture (oc , simpleDeploymentFixture )
136
136
o .Expect (err ).NotTo (o .HaveOccurred ())
137
137
138
138
_ , err = oc .Run ("set" , "env" ).Args (resource , "TRY=ONCE" ).Output ()
139
139
o .Expect (err ).NotTo (o .HaveOccurred ())
140
140
141
- condition := func () (bool , error ) {
142
- dc , rcs , pods , err := deploymentInfo (oc , name )
141
+ g .By (fmt .Sprintf ("by checking that the deployment config has the correct version" ))
142
+ err = wait .PollImmediate (500 * time .Millisecond , 5 * time .Second , func () (bool , error ) {
143
+ dc , _ , _ , err := deploymentInfo (oc , name )
143
144
if err != nil {
144
145
return false , nil
145
146
}
147
+ return dc .Status .LatestVersion == 2 , nil
148
+ })
149
+ o .Expect (err ).NotTo (o .HaveOccurred ())
146
150
147
- // Check that the deployment config has latestVersion=2
148
- g .By (fmt .Sprintf ("by checking that the deployment config has the correct version" ))
149
- hasCorrectLatestVersion := dc .Status .LatestVersion == 2
151
+ g .By (fmt .Sprintf ("by checking that the second deployment exists" ))
152
+ err = wait .PollImmediate (500 * time .Millisecond , 10 * time .Second , func () (bool , error ) {
153
+ _ , rcs , _ , err := deploymentInfo (oc , name )
154
+ if err != nil {
155
+ return false , nil
156
+ }
150
157
151
- // Check that the second deployment exists.
152
- g .By (fmt .Sprintf ("by checking that the second deployment exists" ))
153
158
secondDeploymentExists := false
154
159
for _ , rc := range rcs {
155
160
if rc .Name == deployutil .DeploymentNameForConfigVersion (name , 2 ) {
@@ -158,8 +163,17 @@ var _ = g.Describe("deploymentconfigs", func() {
158
163
}
159
164
}
160
165
161
- // Check that the first deployer is deleted and the second deployer exists.
162
- g .By (fmt .Sprintf ("by checking that the first deployer was deleted and the second deployer exists" ))
166
+ return secondDeploymentExists , nil
167
+ })
168
+ o .Expect (err ).NotTo (o .HaveOccurred ())
169
+
170
+ g .By (fmt .Sprintf ("by checking that the first deployer was deleted and the second deployer exists" ))
171
+ err = wait .PollImmediate (500 * time .Millisecond , 10 * time .Second , func () (bool , error ) {
172
+ _ , _ , pods , err := deploymentInfo (oc , name )
173
+ if err != nil {
174
+ return false , nil
175
+ }
176
+
163
177
deploymentNamesToDeployers , err := deploymentPods (pods )
164
178
if err != nil {
165
179
return false , nil
@@ -171,12 +185,8 @@ var _ = g.Describe("deploymentconfigs", func() {
171
185
secondDeploymentName := deployutil .DeploymentNameForConfigVersion (name , 2 )
172
186
secondDeployerExists := len (deploymentNamesToDeployers [secondDeploymentName ]) == 1
173
187
174
- return hasCorrectLatestVersion &&
175
- secondDeploymentExists &&
176
- firstDeployerRemoved && secondDeployerExists , nil
177
- }
178
-
179
- err = wait .PollImmediate (500 * time .Millisecond , 10 * time .Second , condition )
188
+ return firstDeployerRemoved && secondDeployerExists , nil
189
+ })
180
190
o .Expect (err ).NotTo (o .HaveOccurred ())
181
191
})
182
192
})
0 commit comments