Skip to content

Commit 4413509

Browse files
committed
change to expect error on httproute refcond
1 parent f7d8cbd commit 4413509

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

conformance/tests/basic/inferencepool_invalid_epp_service.go

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package basic
1818

1919
import (
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

3234
func init() {
@@ -35,7 +37,7 @@ func init() {
3537

3638
var 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
}
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: inference.networking.x-k8s.io/v1alpha2
22
kind: InferencePool
33
metadata:
4-
name: pool-non-existent-epp
4+
name: pool-with-invalid-epp
55
namespace: gateway-conformance-app-backend
66
spec:
77
selector:
@@ -13,21 +13,19 @@ spec:
1313
apiVersion: gateway.networking.k8s.io/v1
1414
kind: HTTPRoute
1515
metadata:
16-
name: httproute-for-pool-non-existent-epp
16+
name: httproute-for-invalid-epp-pool
1717
namespace: gateway-conformance-app-backend
1818
spec:
1919
parentRefs:
20-
- group: gateway.networking.k8s.io
21-
kind: Gateway
22-
name: conformance-gateway
20+
- name: conformance-gateway
2321
namespace: gateway-conformance-infra
2422
rules:
2523
- backendRefs:
26-
- group: inference.networking.x-k8s.io
24+
- name: pool-with-invalid-epp
2725
kind: InferencePool
28-
name: pool-non-existent-epp
26+
group: inference.networking.x-k8s.io
2927
port: 80
3028
matches:
3129
- path:
3230
type: PathPrefix
33-
value: /non-existent-epp-pool-test
31+
value: /invalid-epp-test

0 commit comments

Comments
 (0)