|
| 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 | +} |
0 commit comments