generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 205
feat(conformance): Add test for HTTPRouteInvalidInferencePoolRef #807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
k8s-ci-robot
merged 53 commits into
kubernetes-sigs:main
from
SinaChavoshi:inf_pool_tests_5
May 27, 2025
Merged
Changes from 51 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
eae4c99
Add inferencepool_lifecycle test.
SinaChavoshi 404f522
Resolve setup issues and enable InferencePool test
SinaChavoshi d396ecb
correct Lint error Multiplication of durations
SinaChavoshi 0455c47
Fix missing containerPort, is missing
SinaChavoshi b531e66
change gateway name from "gateway-conformance-app" to "conformance-ga…
SinaChavoshi 5510e69
clarify why K8s types are needed.
SinaChavoshi 04c9798
Update conformance/conformance.go
SinaChavoshi 9427f31
Update conformance/conformance.go
SinaChavoshi 093d3ad
remove for loop when adding SupportedFeatures
SinaChavoshi e3c8381
remove exessive logging
SinaChavoshi c9a8f77
Update conformance/conformance.go
SinaChavoshi 5ac19ff
move excess debug logs behind debug flag.
SinaChavoshi 3b8df3b
remove CONFORMANCE.GO prefix from logs.
SinaChavoshi bde61b8
change the pull logic and use default value from GatewayMustHaveAddress
SinaChavoshi 57d68fd
fix mt.Sprintf can be replaced with string concatenation
SinaChavoshi fa93b15
add a function for logDebug
SinaChavoshi 06f29cc
factor out ensureGatewayAvailableAndReady
SinaChavoshi da2e9ef
removed todo comment in helper.go
SinaChavoshi 5e1d8e9
remove CONFORMANCE.GO from log
SinaChavoshi f424464
Add InferencePoolLifecycle test
SinaChavoshi 84d1ba2
update comments in helper.go
SinaChavoshi 5ad31cb
Initial commit for InferencePoolNoMatchingPodsRouteStatus test
SinaChavoshi 738089b
resolve lint issue.
SinaChavoshi d8577b0
error messages, should not be capitalized or end with punctuation
SinaChavoshi 0af3cb6
Merge branch 'inf_pool_tests' into inf_pool_tests_3
SinaChavoshi 63a82ed
Merge branch 'inf_pool_tests_3' into inf_pool_tests_5
SinaChavoshi fc3ee1e
Add inferencepool_lifecycle test.
SinaChavoshi ba677ac
Resolve setup issues and enable InferencePool test
SinaChavoshi 3ff24a1
removed todo comment in helper.go
SinaChavoshi 2dad18d
Add InferencePoolLifecycle test
SinaChavoshi 0052a23
update comments in helper.go
SinaChavoshi ebfe6df
Merge branch 'inf_pool_tests_3' into inf_pool_tests_5
SinaChavoshi b419259
remove Conformanc.go from log message
SinaChavoshi 08ca992
Merge branch 'inf_pool_tests_3' into inf_pool_tests_5
SinaChavoshi f54b575
Remove lifecycle test.
SinaChavoshi 731f734
Merge branch 'inf_pool_tests_3' into inf_pool_tests_5
SinaChavoshi 91b053b
Removed unused helper methods ( inference pool must have selector & m…
SinaChavoshi d441791
Merge branch 'inf_pool_tests_3' into inf_pool_tests_5
SinaChavoshi 3a98b84
add back HTTPRouteMustHaveParentStatusConditions
SinaChavoshi e4c18d5
Set timeout values as constant
SinaChavoshi a07874b
Merge branch 'inf_pool_tests_3' into inf_pool_tests_5
SinaChavoshi 36073dd
Merge branch 'main' into inf_pool_tests_3
SinaChavoshi cd042fe
change timeout.go to timing.go
SinaChavoshi c99b24c
Merge branch 'inf_pool_tests_3' into inf_pool_tests_5
SinaChavoshi 8c7470c
Merge branch 'main' into inf_pool_tests_5
SinaChavoshi 482103c
remove duplicate log
SinaChavoshi 3259e0f
remove excess comments and logs
SinaChavoshi 8f3c119
add comment / todo for Reconciled
SinaChavoshi 9324f23
Update conformance/utils/kubernetes/helpers.go
SinaChavoshi 50130f1
change test to HTTPRouteInvalidInferencePoolRef
SinaChavoshi 53325d9
Merge branch 'inf_pool_tests_5' of https://github.com/SinaChavoshi/ga…
SinaChavoshi 63c80aa
use TODO: instead of TODO()
SinaChavoshi 851f989
yaml and todos based on code review
SinaChavoshi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
conformance/tests/basic/httproute_invalid_inferencepool_ref.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| 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. | ||
| */ | ||
|
|
||
| // TODO() refactor the structure to put all tests directly under tests instead of creating subfolders. | ||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| package basic | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/apimachinery/pkg/types" | ||
| gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" | ||
| "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" | ||
| ) | ||
|
|
||
| func init() { | ||
| tests.ConformanceTests = append(tests.ConformanceTests, HTTPRouteInvalidInferencePoolRef) | ||
| } | ||
|
|
||
| var HTTPRouteInvalidInferencePoolRef = suite.ConformanceTest{ | ||
| ShortName: "HTTPRouteInvalidInferencePoolRef", | ||
| Description: "Tests HTTPRoute status when it references an InferencePool that does not exist.", | ||
| Manifests: []string{"tests/basic/httproute_invalid_inferencepool_ref.yaml"}, | ||
| Features: []features.FeatureName{ | ||
| features.FeatureName("SupportInferencePool"), | ||
| features.SupportGateway, | ||
| }, | ||
| Test: func(t *testing.T, s *suite.ConformanceTestSuite) { | ||
| const ( | ||
| appBackendNamespace = "gateway-conformance-app-backend" | ||
| infraNamespace = "gateway-conformance-infra" | ||
| routeName = "httproute-to-non-existent-pool" | ||
| gatewayName = "conformance-gateway" | ||
| ) | ||
| routeNN := types.NamespacedName{Name: routeName, Namespace: appBackendNamespace} | ||
| gatewayNN := types.NamespacedName{Name: gatewayName, Namespace: infraNamespace} | ||
|
|
||
| t.Run("HTTPRoute should have Accepted=True and ResolvedRefs=False for non-existent InferencePool", func(t *testing.T) { | ||
| acceptedCondition := metav1.Condition{ | ||
| Type: string(gatewayv1.RouteConditionAccepted), | ||
| Status: metav1.ConditionTrue, | ||
| Reason: string(gatewayv1.RouteReasonAccepted), | ||
| } | ||
| kubernetes.HTTPRouteMustHaveCondition(t, s.Client, s.TimeoutConfig, routeNN, gatewayNN, acceptedCondition) | ||
|
|
||
| resolvedRefsCondition := metav1.Condition{ | ||
| Type: string(gatewayv1.RouteConditionResolvedRefs), | ||
| Status: metav1.ConditionFalse, | ||
| Reason: string(gatewayv1.RouteReasonBackendNotFound), | ||
| } | ||
| kubernetes.HTTPRouteMustHaveCondition(t, s.Client, s.TimeoutConfig, routeNN, gatewayNN, resolvedRefsCondition) | ||
|
|
||
| t.Logf("Successfully verified HTTPRoute %s has conditions: Accepted=True and ResolvedRefs=False (Reason: BackendNotFound) for Gateway %s", | ||
| routeNN.String(), gatewayNN.String()) | ||
| }) | ||
| }, | ||
| } | ||
31 changes: 31 additions & 0 deletions
31
conformance/tests/basic/httproute_invalid_inferencepool_ref.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # httproute_invalid_inferencepool_ref.yaml | ||
| # This manifest defines an HTTPRoute that references an InferencePool | ||
| # by name ("non-existent-inference-pool") which is intentionally NOT defined. | ||
| # The test will verify that the HTTPRoute reflects an appropriate | ||
| # failure status because the referenced InferencePool backend cannot be found. | ||
|
|
||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| # This name must match the 'routeNN.Name' in the Go test file. | ||
| name: httproute-to-non-existent-pool | ||
| # This namespace should be one created by the base manifests, | ||
| # typically where backend applications and their routes reside. | ||
| namespace: gateway-conformance-app-backend | ||
| spec: | ||
| parentRefs: | ||
| - group: gateway.networking.k8s.io | ||
| kind: Gateway | ||
| name: conformance-gateway # Name of the shared Gateway from base manifests | ||
| namespace: gateway-conformance-infra # Namespace of the shared Gateway | ||
| sectionName: http | ||
| rules: | ||
| - backendRefs: | ||
| - group: inference.networking.x-k8s.io | ||
| kind: InferencePool | ||
| name: non-existent-inference-pool # Intentionally Non-Existing | ||
| port: 8080 | ||
SinaChavoshi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| matches: | ||
| - path: | ||
| type: PathPrefix | ||
| value: /test-non-existent-pool | ||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.