@@ -17,6 +17,7 @@ limitations under the License.
1717package basic
1818
1919import (
20+ "net/http"
2021 "testing"
2122
2223 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -27,6 +28,7 @@ import (
2728
2829 "sigs.k8s.io/gateway-api-inference-extension/conformance/tests"
2930 gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
31+ conformancehttp "sigs.k8s.io/gateway-api/conformance/utils/http"
3032)
3133
3234func init () {
@@ -35,7 +37,7 @@ func init() {
3537
3638var InferencePoolInvalidEPPService = suite.ConformanceTest {
3739 ShortName : "InferencePoolInvalidEPPService" ,
38- Description : "Validate that a Gateway reports a failure status when an HTTPRoute references an InferencePool whose EPP service reference does not exist ." ,
40+ Description : "An HTTPRoute that references an InferencePool with a non-existent EPP service should have a ResolvedRefs condition with a status of False and a reason of BackendNotFound ." ,
3941 Manifests : []string {"tests/basic/inferencepool_invalid_epp_service.yaml" },
4042 Features : []features.FeatureName {
4143 features .SupportGateway ,
@@ -44,20 +46,34 @@ var InferencePoolInvalidEPPService = suite.ConformanceTest{
4446 },
4547 Test : func (t * testing.T , s * suite.ConformanceTestSuite ) {
4648 const (
49+ routePath = "/invalid-epp-test"
4750 infraNamespace = "gateway-conformance-infra"
48- gatewayName = "conformance-gateway "
51+ appNamespace = "gateway- conformance-app-backend "
4952 )
5053
51- gatewayNN := types.NamespacedName {Name : gatewayName , Namespace : infraNamespace }
54+ routeNN := types.NamespacedName {Name : "httproute-for-invalid-epp-pool" , Namespace : appNamespace }
55+ gwNN := types.NamespacedName {Name : "conformance-gateway" , Namespace : infraNamespace }
5256
53- t .Run ("Verify Gateway reports Programmed:Invalid backend reference" , func (t * testing.T ) {
54- expectedCondition := metav1.Condition {
55- Type : string (gatewayv1 .GatewayConditionProgrammed ),
57+ 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 ),
5662 Status : metav1 .ConditionFalse ,
57- Reason : string (gatewayv1 .GatewayReasonInvalid ),
63+ Reason : string (gatewayv1 .RouteReasonBackendNotFound ),
5864 }
65+ kubernetes .HTTPRouteMustHaveCondition (t , s .Client , s .TimeoutConfig , routeNN , gwNN , resolvedRefsCond )
66+ })
5967
60- kubernetes .GatewayMustHaveCondition (t , s .Client , s .TimeoutConfig , gatewayNN , expectedCondition )
68+ 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+ },
76+ })
6177 })
6278 },
6379}
0 commit comments