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