@@ -245,6 +245,22 @@ var _ = SIGDescribe("Deployment", func() {
245
245
framework .ExpectNoError (err , "failed to Marshal Deployment JSON patch" )
246
246
_ , err = f .ClientSet .AppsV1 ().Deployments (testNamespaceName ).Patch (context .TODO (), testDeploymentName , types .StrategicMergePatchType , []byte (deploymentPatch ), metav1.PatchOptions {})
247
247
framework .ExpectNoError (err , "failed to patch Deployment" )
248
+ ctx , cancel = context .WithTimeout (context .Background (), 30 * time .Second )
249
+ defer cancel ()
250
+ _ , err = watchtools .Until (ctx , deploymentsList .ResourceVersion , w , func (event watch.Event ) (bool , error ) {
251
+ switch event .Type {
252
+ case watch .Modified :
253
+ if deployment , ok := event .Object .(* appsv1.Deployment ); ok {
254
+ found := deployment .ObjectMeta .Name == testDeployment .Name &&
255
+ deployment .Labels ["test-deployment-static" ] == "true"
256
+ return found , nil
257
+ }
258
+ default :
259
+ framework .Logf ("observed event type %v" , event .Type )
260
+ }
261
+ return false , nil
262
+ })
263
+ framework .ExpectNoError (err , "failed to see %v event" , watch .Modified )
248
264
249
265
ginkgo .By ("waiting for Replicas to scale" )
250
266
ctx , cancel = context .WithTimeout (context .Background (), 30 * time .Second )
@@ -254,7 +270,8 @@ var _ = SIGDescribe("Deployment", func() {
254
270
found := deployment .ObjectMeta .Name == testDeployment .Name &&
255
271
deployment .Labels ["test-deployment-static" ] == "true" &&
256
272
deployment .Status .AvailableReplicas == testDeploymentMinimumReplicas &&
257
- deployment .Status .ReadyReplicas == testDeploymentMinimumReplicas
273
+ deployment .Status .ReadyReplicas == testDeploymentMinimumReplicas &&
274
+ deployment .Spec .Template .Spec .Containers [0 ].Image == testDeploymentPatchImage
258
275
return found , nil
259
276
}
260
277
return false , nil
@@ -268,16 +285,14 @@ var _ = SIGDescribe("Deployment", func() {
268
285
for _ , deploymentItem := range deploymentsList .Items {
269
286
if deploymentItem .ObjectMeta .Name == testDeploymentName &&
270
287
deploymentItem .ObjectMeta .Namespace == testNamespaceName &&
271
- deploymentItem .ObjectMeta .Labels ["test-deployment-static" ] == "true" &&
272
- * deploymentItem .Spec .Replicas == testDeploymentMinimumReplicas &&
273
- deploymentItem .Spec .Template .Spec .Containers [0 ].Image == testDeploymentPatchImage {
288
+ deploymentItem .ObjectMeta .Labels ["test-deployment-static" ] == "true" {
274
289
foundDeployment = true
275
290
break
276
291
}
277
292
}
278
293
framework .ExpectEqual (foundDeployment , true , "unable to find the Deployment in list" , deploymentsList )
279
294
280
- ginkgo .By ("updating the DeploymentStatus " )
295
+ ginkgo .By ("updating the Deployment " )
281
296
testDeploymentUpdate := testDeployment
282
297
testDeploymentUpdate .ObjectMeta .Labels ["test-deployment" ] = "updated"
283
298
testDeploymentUpdate .Spec .Template .Spec .Containers [0 ].Image = testDeploymentUpdateImage
0 commit comments