Skip to content

Commit a879542

Browse files
same-namespace-attachment-mesh-conformance (#3833)
1 parent 69a4a5f commit a879542

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 meshtests
18+
19+
import (
20+
"testing"
21+
22+
"sigs.k8s.io/gateway-api/conformance/utils/echo"
23+
"sigs.k8s.io/gateway-api/conformance/utils/http"
24+
"sigs.k8s.io/gateway-api/conformance/utils/suite"
25+
"sigs.k8s.io/gateway-api/pkg/features"
26+
)
27+
28+
func init() {
29+
MeshConformanceTests = append(MeshConformanceTests, MeshHTTPRouteSimpleSameNamespace)
30+
}
31+
32+
var MeshHTTPRouteSimpleSameNamespace = suite.ConformanceTest{
33+
ShortName: "MeshHTTPRouteSimpleSameNamespace",
34+
Description: "A single HTTPRoute in the gateway-conformance-mesh namespace attaches to a Service in the same namespace",
35+
Features: []features.FeatureName{
36+
features.SupportMesh,
37+
features.SupportHTTPRoute,
38+
},
39+
Manifests: []string{"tests/mesh/httproute-simple-same-namespace.yaml"},
40+
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
41+
ns := "gateway-conformance-mesh"
42+
client := echo.ConnectToApp(t, s, echo.MeshAppEchoV1)
43+
t.Run("Simple HTTP request should reach infra-backend", func(t *testing.T) {
44+
client.MakeRequestAndExpectEventuallyConsistentResponse(t, http.ExpectedResponse{
45+
Request: http.Request{Path: "/", Host: "echo"},
46+
Response: http.Response{StatusCode: 200},
47+
Backend: "echo-v1",
48+
Namespace: ns,
49+
}, s.TimeoutConfig)
50+
})
51+
},
52+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: HTTPRoute
3+
metadata:
4+
name: gateway-conformance-mesh-test
5+
namespace: gateway-conformance-mesh
6+
spec:
7+
parentRefs:
8+
- group: ""
9+
kind: Service
10+
name: echo
11+
port: 80
12+
rules:
13+
- backendRefs:
14+
- name: echo-v1
15+
port: 8080

0 commit comments

Comments
 (0)