...
1
16
17 package tests
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 )
26
27 func init() {
28 ConformanceTests = append(ConformanceTests, MeshFrontend)
29 }
30
31 var MeshFrontend = suite.ConformanceTest{
32 ShortName: "MeshFrontend",
33 Description: "Mesh rules should only apply to the associated frontend",
34 Features: []suite.SupportedFeature{
35 suite.SupportMesh,
36 suite.SupportHTTPRoute,
37 suite.SupportHTTPRouteResponseHeaderModification,
38 },
39 Manifests: []string{"tests/mesh-frontend.yaml"},
40 Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
41 client := echo.ConnectToApp(t, s, echo.MeshAppEchoV1)
42 v2 := echo.ConnectToApp(t, s, echo.MeshAppEchoV2)
43 cases := []http.ExpectedResponse{
44 {
45 TestCaseName: "Send to service",
46 Request: http.Request{
47 Host: "echo-v2",
48 Method: "GET",
49 },
50 Response: http.Response{
51 StatusCode: 200,
52
53 Headers: map[string]string{
54 "X-Header-Set": "set",
55 },
56 },
57 Backend: "echo-v2",
58 },
59 {
60 TestCaseName: "Send to pod IP",
61 Request: http.Request{
62 Host: v2.Address,
63 Method: "GET",
64 },
65 Response: http.Response{
66 StatusCode: 200,
67 AbsentHeaders: []string{"X-Header-Set"},
68 },
69 Backend: "echo-v2",
70 },
71 }
72 for i := range cases {
73
74
75 tc := cases[i]
76 t.Run(tc.GetTestCaseName(i), func(t *testing.T) {
77 client.MakeRequestAndExpectEventuallyConsistentResponse(t, tc, s.TimeoutConfig)
78 })
79 }
80 },
81 }
82
View as plain text