@@ -220,7 +220,6 @@ func (rm *ResourceManager) getFileContents(file string) (*bytes.Buffer, error) {
220
220
221
221
// WaitForAppsToBeReady waits for all apps in the specified namespace to be ready,
222
222
// or until the ctx timeout is reached.
223
-
224
223
func (rm * ResourceManager ) WaitForAppsToBeReady (namespace string ) error {
225
224
ctx , cancel := context .WithTimeout (context .Background (), rm .TimeoutConfig .CreateTimeout )
226
225
defer cancel ()
@@ -229,6 +228,10 @@ func (rm *ResourceManager) WaitForAppsToBeReady(namespace string) error {
229
228
return err
230
229
}
231
230
231
+ if err := rm .waitForRoutesToBeReady (ctx , namespace ); err != nil {
232
+ return err
233
+ }
234
+
232
235
return rm .waitForGatewaysToBeReady (ctx , namespace )
233
236
}
234
237
@@ -252,11 +255,7 @@ func (rm *ResourceManager) waitForPodsToBeReady(ctx context.Context, namespace s
252
255
}
253
256
}
254
257
255
- if podsReady == len (podList .Items ) {
256
- return true , nil
257
- }
258
-
259
- return false , nil
258
+ return podsReady == len (podList .Items ), nil
260
259
},
261
260
)
262
261
}
@@ -284,3 +283,31 @@ func (rm *ResourceManager) waitForGatewaysToBeReady(ctx context.Context, namespa
284
283
},
285
284
)
286
285
}
286
+
287
+ func (rm * ResourceManager ) waitForRoutesToBeReady (ctx context.Context , namespace string ) error {
288
+ return wait .PollUntilContextCancel (
289
+ ctx ,
290
+ 500 * time .Millisecond ,
291
+ true , /* poll immediately */
292
+ func (ctx context.Context ) (bool , error ) {
293
+ var routeList v1.HTTPRouteList
294
+ if err := rm .K8sClient .List (ctx , & routeList , client .InNamespace (namespace )); err != nil {
295
+ return false , err
296
+ }
297
+
298
+ var numParents , readyCount int
299
+ for _ , route := range routeList .Items {
300
+ numParents += len (route .Status .Parents )
301
+ for _ , parent := range route .Status .Parents {
302
+ for _ , cond := range parent .Conditions {
303
+ if cond .Type == string (v1 .RouteConditionAccepted ) && cond .Status == metav1 .ConditionTrue {
304
+ readyCount ++
305
+ }
306
+ }
307
+ }
308
+ }
309
+
310
+ return numParents == readyCount , nil
311
+ },
312
+ )
313
+ }
0 commit comments