@@ -137,9 +137,11 @@ public VerificationResult verify(KubectlWrapper kubectl, Manifests.ManifestObjec
137137 * available replicas (status.availableReplicas).
138138 */
139139 private static class DeploymentVerifier implements Verifier {
140- private static final String AVAILABLE_REPLICAS = "availableReplicas" ;
141- private static final String MINIMUM_REPLICAS_JSONPATH = "spec.replicas" ;
142140 private static final String STATUS_JSONPATH = "status" ;
141+ private static final String AVAILABLE_REPLICAS = "availableReplicas" ;
142+ private static final String UPDATED_REPLICAS = "updatedReplicas" ;
143+ private static final String REPLICAS = "replicas" ;
144+ private static final String DESIRED_REPLICAS_JSONPATH = "spec.replicas" ;
143145
144146 /**
145147 * Verifies that the deployment was applied to the GKE cluster.
@@ -162,18 +164,24 @@ public VerificationResult verify(KubectlWrapper kubectl, Manifests.ManifestObjec
162164 return errorResult (e , object );
163165 }
164166
165- Integer minReplicas = JsonPath .read (json , MINIMUM_REPLICAS_JSONPATH );
167+ Integer desiredReplicas = JsonPath .read (json , DESIRED_REPLICAS_JSONPATH );
166168 Map <String , Object > status = JsonPath .read (json , STATUS_JSONPATH );
167169 Integer availableReplicas = (Integer ) status .getOrDefault (AVAILABLE_REPLICAS , 0 );
168- boolean verified = minReplicas != null
169- && availableReplicas != null
170- && minReplicas .intValue () <= availableReplicas .intValue ();
170+ Integer updatedReplicas = (Integer ) status .getOrDefault (UPDATED_REPLICAS , 0 );
171+ Integer replicas = (Integer ) status .getOrDefault (REPLICAS , 0 );
172+ boolean verified = desiredReplicas != null
173+ && updatedReplicas .intValue () >= desiredReplicas .intValue ()
174+ && replicas .intValue () <= updatedReplicas .intValue ()
175+ && availableReplicas .intValue () == updatedReplicas .intValue ();
171176
172177 log .append ("AvailableReplicas = " )
173178 .append (availableReplicas )
174179 .append ("," )
175- .append (" MinimumReplicas = " )
176- .append (minReplicas )
180+ .append (" UpdatedReplicas = " )
181+ .append (updatedReplicas )
182+ .append ("," )
183+ .append (" DesiredReplicas = " )
184+ .append (desiredReplicas )
177185 .append ("\n " );
178186
179187 return new VerificationResult (log .toString (), verified , object );
0 commit comments