@@ -17,18 +17,18 @@ limitations under the License.
17
17
package basic
18
18
19
19
import (
20
- "net/http"
21
20
"testing"
22
21
23
22
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24
23
"k8s.io/apimachinery/pkg/types"
24
+ inferenceapi "sigs.k8s.io/gateway-api-inference-extension/api/v1alpha2"
25
25
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
26
26
"sigs.k8s.io/gateway-api/conformance/utils/suite"
27
27
"sigs.k8s.io/gateway-api/pkg/features"
28
28
29
29
"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 "
32
32
)
33
33
34
34
func init () {
@@ -49,30 +49,27 @@ var InferencePoolInvalidEPPService = suite.ConformanceTest{
49
49
routePath = "/invalid-epp-test"
50
50
infraNamespace = "gateway-conformance-infra"
51
51
appNamespace = "gateway-conformance-app-backend"
52
+ poolName = "pool-with-invalid-epp"
52
53
)
53
54
54
55
routeNN := types.NamespacedName {Name : "httproute-for-invalid-epp-pool" , Namespace : appNamespace }
55
56
gwNN := types.NamespacedName {Name : "conformance-primary-gateway" , Namespace : infraNamespace }
57
+ poolNN := types.NamespacedName {Name : poolName , Namespace : appNamespace }
56
58
57
59
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
62
63
Status : metav1 .ConditionFalse ,
63
- Reason : string ( gatewayv1 . RouteReasonBackendNotFound ),
64
+ Reason : "" , // "" means we don't strictly check the Reason for this basic test.
64
65
}
65
- kubernetes . HTTPRouteMustHaveCondition (t , s .Client , s . TimeoutConfig , routeNN , gwNN , resolvedRefsCond )
66
+ k8sutils . InferencePoolMustHaveCondition (t , s .Client , poolNN , acceptedCondition )
66
67
})
67
68
68
69
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.
76
73
})
77
74
})
78
75
},
0 commit comments