@@ -69,7 +69,7 @@ func checkCondition(t *testing.T, conditions []metav1.Condition, expectedConditi
6969// InferencePoolMustHaveCondition waits for the specified InferencePool resource
7070// to exist and report the expected status condition within one of its parent statuses.
7171// 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 ) {
7373 t .Helper () // Marks this function as a test helper
7474
7575 var timeoutConfig = config .DefaultInferenceExtensionTimeoutConfig ()
@@ -104,9 +104,11 @@ func InferencePoolMustHaveCondition(t *testing.T, c client.Reader, poolNN types.
104104 }
105105
106106 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+ }
110112 }
111113 }
112114 return false , nil
@@ -242,8 +244,8 @@ func HTTPRouteMustBeAcceptedAndResolved(t *testing.T, c client.Client, timeoutCo
242244
243245// InferencePoolMustBeAcceptedByParent waits for the specified InferencePool
244246// 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 ) {
247249 t .Helper ()
248250
249251 acceptedByParentCondition := metav1.Condition {
@@ -253,28 +255,10 @@ func InferencePoolMustBeAcceptedByParent(t *testing.T, c client.Reader, poolNN t
253255 }
254256
255257 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 )
257259 t .Logf ("InferencePool %s is Accepted by a parent Gateway (Reason: %s)" , poolNN .String (), gatewayv1 .GatewayReasonAccepted )
258260}
259261
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-
278262// HTTPRouteAndInferencePoolMustBeAcceptedAndRouteAccepted waits for the specified HTTPRoute
279263// to be Accepted and have its references resolved by the specified Gateway,
280264// AND for the specified InferencePool to be "RouteAccepted" using the specific
@@ -289,7 +273,7 @@ func HTTPRouteAndInferencePoolMustBeAcceptedAndRouteAccepted(
289273 var timeoutConfig = config .DefaultInferenceExtensionTimeoutConfig ()
290274
291275 HTTPRouteMustBeAcceptedAndResolved (t , c , timeoutConfig .TimeoutConfig , routeNN , gatewayNN )
292- InferencePoolMustBeRouteAccepted (t , c , poolNN )
276+ InferencePoolMustBeAcceptedByParent (t , c , poolNN , gatewayNN )
293277 t .Logf ("Successfully verified: HTTPRoute %s (Gateway %s) is Accepted & Resolved, and InferencePool %s is RouteAccepted." ,
294278 routeNN .String (), gatewayNN .String (), poolNN .String ())
295279}
0 commit comments