Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions conformance/tests/basic/inferencepool_invalid_epp_service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
Copyright 2025 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package basic

import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
"sigs.k8s.io/gateway-api/pkg/features"

"sigs.k8s.io/gateway-api-inference-extension/conformance/tests"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
)

func init() {
tests.ConformanceTests = append(tests.ConformanceTests, InferencePoolInvalidEPPService)
}

var InferencePoolInvalidEPPService = suite.ConformanceTest{
ShortName: "InferencePoolInvalidEPPService",
Description: "Validate that a Gateway reports a failure status when an HTTPRoute references an InferencePool whose EPP service reference does not exist.",
Manifests: []string{"tests/basic/inferencepool_invalid_epp_service.yaml"},
Features: []features.FeatureName{
features.SupportGateway,
features.SupportHTTPRoute,
features.FeatureName("SupportInferencePool"),
},
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
const (
infraNamespace = "gateway-conformance-infra"
gatewayName = "conformance-gateway"
)

gatewayNN := types.NamespacedName{Name: gatewayName, Namespace: infraNamespace}

t.Run("Verify Gateway reports Programmed:Invalid backend reference", func(t *testing.T) {
expectedCondition := metav1.Condition{
Type: string(gatewayv1.GatewayConditionProgrammed),
Status: metav1.ConditionFalse,
Reason: string(gatewayv1.GatewayReasonInvalid),
}

kubernetes.GatewayMustHaveCondition(t, s.Client, s.TimeoutConfig, gatewayNN, expectedCondition)
})
},
}
33 changes: 33 additions & 0 deletions conformance/tests/basic/inferencepool_invalid_epp_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: inference.networking.x-k8s.io/v1alpha2
kind: InferencePool
metadata:
name: pool-non-existent-epp
namespace: gateway-conformance-app-backend
spec:
selector:
app: "inference-model-1"
targetPortNumber: 3000
extensionRef:
name: non-existent-epp-svc
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: httproute-for-pool-non-existent-epp
namespace: gateway-conformance-app-backend
spec:
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: conformance-gateway
namespace: gateway-conformance-infra
rules:
- backendRefs:
- group: inference.networking.x-k8s.io
kind: InferencePool
name: pool-non-existent-epp
port: 80
matches:
- path:
type: PathPrefix
value: /non-existent-epp-pool-test