@@ -17,18 +17,18 @@ limitations under the License.
1717package basic
1818
1919import (
20- "net/http"
2120 "testing"
2221
2322 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2423 "k8s.io/apimachinery/pkg/types"
24+ inferenceapi "sigs.k8s.io/gateway-api-inference-extension/api/v1alpha2"
2525 "sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
2626 "sigs.k8s.io/gateway-api/conformance/utils/suite"
2727 "sigs.k8s.io/gateway-api/pkg/features"
2828
2929 "sigs.k8s.io/gateway-api-inference-extension/conformance/tests"
30- gatewayv1 "sigs.k8s.io/gateway-api/apis/v1 "
31- conformancehttp "sigs.k8s.io/gateway-api/conformance/utils/http "
30+ k8sutils "sigs.k8s.io/gateway-api-inference-extension/conformance/utils/kubernetes "
31+ trafficutils "sigs.k8s.io/gateway-api-inference-extension /conformance/utils/traffic "
3232)
3333
3434func init () {
@@ -49,30 +49,27 @@ var InferencePoolInvalidEPPService = suite.ConformanceTest{
4949 routePath = "/invalid-epp-test"
5050 infraNamespace = "gateway-conformance-infra"
5151 appNamespace = "gateway-conformance-app-backend"
52+ poolName = "pool-with-invalid-epp"
5253 )
5354
5455 routeNN := types.NamespacedName {Name : "httproute-for-invalid-epp-pool" , Namespace : appNamespace }
5556 gwNN := types.NamespacedName {Name : "conformance-primary-gateway" , Namespace : infraNamespace }
57+ poolNN := types.NamespacedName {Name : poolName , Namespace : appNamespace }
5658
5759 gwAddr := kubernetes .GatewayAndHTTPRoutesMustBeAccepted (t , s .Client , s .TimeoutConfig , s .ControllerName , kubernetes .NewGatewayRef (gwNN ), routeNN )
58-
59- t .Run ("HTTPRoute has a ResolvedRefs Condition with status False and Reason BackendNotFound" , func (t * testing.T ) {
60- resolvedRefsCond := metav1.Condition {
61- Type : string (gatewayv1 .RouteConditionResolvedRefs ),
60+ t .Run ("InferecePool has a ResolvedRefs Condition with status False" , func (t * testing.T ) {
61+ acceptedCondition := metav1.Condition {
62+ Type : string (inferenceapi .InferencePoolConditionResolvedRefs ), // Standard condition type
6263 Status : metav1 .ConditionFalse ,
63- Reason : string ( gatewayv1 . RouteReasonBackendNotFound ),
64+ Reason : "" , // "" means we don't strictly check the Reason for this basic test.
6465 }
65- kubernetes . HTTPRouteMustHaveCondition (t , s .Client , s . TimeoutConfig , routeNN , gwNN , resolvedRefsCond )
66+ k8sutils . InferencePoolMustHaveCondition (t , s .Client , poolNN , acceptedCondition )
6667 })
6768
6869 t .Run ("Request to a route with an invalid backend reference receives a 500 response" , func (t * testing.T ) {
69- conformancehttp .MakeRequestAndExpectEventuallyConsistentResponse (t , s .RoundTripper , s .TimeoutConfig , gwAddr , conformancehttp.ExpectedResponse {
70- Request : conformancehttp.Request {
71- Path : routePath ,
72- },
73- Response : conformancehttp.Response {
74- StatusCode : http .StatusInternalServerError ,
75- },
70+ trafficutils .MakeRequestAndExpectEventuallyConsistentResponse (t , s .RoundTripper , s .TimeoutConfig , gwAddr , trafficutils.Request {
71+ Path : routePath ,
72+ ExpectedStatusCode : 5 , // Expecting response status code 5XX.
7673 })
7774 })
7875 },
0 commit comments