@@ -69,7 +69,7 @@ func checkCondition(t *testing.T, conditions []metav1.Condition, expectedConditi
69
69
// InferencePoolMustHaveCondition waits for the specified InferencePool resource
70
70
// to exist and report the expected status condition within one of its parent statuses.
71
71
// It polls the InferencePool's status until the condition is met or the timeout occurs.
72
- func InferencePoolMustHaveCondition (t * testing.T , c client.Reader , poolNN types.NamespacedName , expectedCondition metav1.Condition ) {
72
+ func InferencePoolMustHaveCondition (t * testing.T , c client.Reader , poolNN types.NamespacedName , gateway types. NamespacedName , expectedCondition metav1.Condition ) {
73
73
t .Helper () // Marks this function as a test helper
74
74
75
75
var timeoutConfig = config .DefaultInferenceExtensionTimeoutConfig ()
@@ -104,9 +104,11 @@ func InferencePoolMustHaveCondition(t *testing.T, c client.Reader, poolNN types.
104
104
}
105
105
106
106
for _ , parentStatus := range pool .Status .Parents {
107
- if checkCondition (t , parentStatus .Conditions , expectedCondition ) {
108
- conditionFound = true
109
- return true , nil
107
+ if parentStatus .GatewayRef .Namespace != nil && string (* parentStatus .GatewayRef .Namespace ) == gateway .Namespace && string (parentStatus .GatewayRef .Name ) == gateway .Name {
108
+ if checkCondition (t , parentStatus .Conditions , expectedCondition ) {
109
+ conditionFound = true
110
+ return true , nil
111
+ }
110
112
}
111
113
}
112
114
return false , nil
@@ -242,8 +244,8 @@ func HTTPRouteMustBeAcceptedAndResolved(t *testing.T, c client.Client, timeoutCo
242
244
243
245
// InferencePoolMustBeAcceptedByParent waits for the specified InferencePool
244
246
// to report an Accepted condition with status True and reason "Accepted"
245
- // from at least one of its parent Gateways .
246
- func InferencePoolMustBeAcceptedByParent (t * testing.T , c client.Reader , poolNN types.NamespacedName ) {
247
+ // from the input Gateway .
248
+ func InferencePoolMustBeAcceptedByParent (t * testing.T , c client.Reader , poolNN , gatewayNN types.NamespacedName ) {
247
249
t .Helper ()
248
250
249
251
acceptedByParentCondition := metav1.Condition {
@@ -253,28 +255,10 @@ func InferencePoolMustBeAcceptedByParent(t *testing.T, c client.Reader, poolNN t
253
255
}
254
256
255
257
t .Logf ("Waiting for InferencePool %s to be Accepted by a parent Gateway (Reason: %s)" , poolNN .String (), gatewayv1 .GatewayReasonAccepted )
256
- InferencePoolMustHaveCondition (t , c , poolNN , acceptedByParentCondition )
258
+ InferencePoolMustHaveCondition (t , c , poolNN , gatewayNN , acceptedByParentCondition )
257
259
t .Logf ("InferencePool %s is Accepted by a parent Gateway (Reason: %s)" , poolNN .String (), gatewayv1 .GatewayReasonAccepted )
258
260
}
259
261
260
- // InferencePoolMustBeRouteAccepted waits for the specified InferencePool resource
261
- // to exist and report an Accepted condition with Type=RouteConditionAccepted,
262
- // Status=True, and Reason=RouteReasonAccepted within one of its parent statuses.
263
- func InferencePoolMustBeRouteAccepted (t * testing.T , c client.Reader , poolNN types.NamespacedName ) {
264
- t .Helper ()
265
-
266
- expectedPoolCondition := metav1.Condition {
267
- Type : string (gatewayv1 .RouteConditionAccepted ),
268
- Status : metav1 .ConditionTrue ,
269
- Reason : string (gatewayv1 .RouteReasonAccepted ),
270
- }
271
-
272
- // Call the existing generic helper with the predefined condition
273
- InferencePoolMustHaveCondition (t , c , poolNN , expectedPoolCondition )
274
- t .Logf ("InferencePool %s successfully verified with RouteAccepted condition (Type: %s, Status: %s, Reason: %s)." ,
275
- poolNN .String (), expectedPoolCondition .Type , expectedPoolCondition .Status , expectedPoolCondition .Reason )
276
- }
277
-
278
262
// HTTPRouteAndInferencePoolMustBeAcceptedAndRouteAccepted waits for the specified HTTPRoute
279
263
// to be Accepted and have its references resolved by the specified Gateway,
280
264
// AND for the specified InferencePool to be "RouteAccepted" using the specific
@@ -289,7 +273,7 @@ func HTTPRouteAndInferencePoolMustBeAcceptedAndRouteAccepted(
289
273
var timeoutConfig = config .DefaultInferenceExtensionTimeoutConfig ()
290
274
291
275
HTTPRouteMustBeAcceptedAndResolved (t , c , timeoutConfig .TimeoutConfig , routeNN , gatewayNN )
292
- InferencePoolMustBeRouteAccepted (t , c , poolNN )
276
+ InferencePoolMustBeAcceptedByParent (t , c , poolNN , gatewayNN )
293
277
t .Logf ("Successfully verified: HTTPRoute %s (Gateway %s) is Accepted & Resolved, and InferencePool %s is RouteAccepted." ,
294
278
routeNN .String (), gatewayNN .String (), poolNN .String ())
295
279
}
0 commit comments