Skip to content

Commit f7d8cbd

Browse files
committed
add tests for InferencePoolInvalidEPPService
1 parent b57fb8a commit f7d8cbd

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package basic
18+
19+
import (
20+
"testing"
21+
22+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23+
"k8s.io/apimachinery/pkg/types"
24+
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
25+
"sigs.k8s.io/gateway-api/conformance/utils/suite"
26+
"sigs.k8s.io/gateway-api/pkg/features"
27+
28+
"sigs.k8s.io/gateway-api-inference-extension/conformance/tests"
29+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
30+
)
31+
32+
func init() {
33+
tests.ConformanceTests = append(tests.ConformanceTests, InferencePoolInvalidEPPService)
34+
}
35+
36+
var InferencePoolInvalidEPPService = suite.ConformanceTest{
37+
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.",
39+
Manifests: []string{"tests/basic/inferencepool_invalid_epp_service.yaml"},
40+
Features: []features.FeatureName{
41+
features.SupportGateway,
42+
features.SupportHTTPRoute,
43+
features.FeatureName("SupportInferencePool"),
44+
},
45+
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
46+
const (
47+
infraNamespace = "gateway-conformance-infra"
48+
gatewayName = "conformance-gateway"
49+
)
50+
51+
gatewayNN := types.NamespacedName{Name: gatewayName, Namespace: infraNamespace}
52+
53+
t.Run("Verify Gateway reports Programmed:Invalid backend reference", func(t *testing.T) {
54+
expectedCondition := metav1.Condition{
55+
Type: string(gatewayv1.GatewayConditionProgrammed),
56+
Status: metav1.ConditionFalse,
57+
Reason: string(gatewayv1.GatewayReasonInvalid),
58+
}
59+
60+
kubernetes.GatewayMustHaveCondition(t, s.Client, s.TimeoutConfig, gatewayNN, expectedCondition)
61+
})
62+
},
63+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: inference.networking.x-k8s.io/v1alpha2
2+
kind: InferencePool
3+
metadata:
4+
name: pool-non-existent-epp
5+
namespace: gateway-conformance-app-backend
6+
spec:
7+
selector:
8+
app: "inference-model-1"
9+
targetPortNumber: 3000
10+
extensionRef:
11+
name: non-existent-epp-svc
12+
---
13+
apiVersion: gateway.networking.k8s.io/v1
14+
kind: HTTPRoute
15+
metadata:
16+
name: httproute-for-pool-non-existent-epp
17+
namespace: gateway-conformance-app-backend
18+
spec:
19+
parentRefs:
20+
- group: gateway.networking.k8s.io
21+
kind: Gateway
22+
name: conformance-gateway
23+
namespace: gateway-conformance-infra
24+
rules:
25+
- backendRefs:
26+
- group: inference.networking.x-k8s.io
27+
kind: InferencePool
28+
name: pool-non-existent-epp
29+
port: 80
30+
matches:
31+
- path:
32+
type: PathPrefix
33+
value: /non-existent-epp-pool-test

0 commit comments

Comments
 (0)