feat(wasm-go): add field reroute to disable route reselection (#2739)

This commit is contained in:
WeixinX
2025-08-11 09:37:35 +08:00
committed by GitHub
parent a1bf1ff009
commit 33ce18df5a
7 changed files with 312 additions and 54 deletions

View File

@@ -575,6 +575,63 @@ var WasmPluginsTransformer = suite.ConformanceTest{
},
},
},
{
Meta: http.AssertionMeta{
TestCaseName: "case 16: request reroute",
TargetBackend: "infra-backend-v1",
TargetNamespace: "higress-conformance-infra",
},
Request: http.AssertionRequest{
ActualRequest: http.Request{
Host: "foo16.com",
Path: "/get",
Headers: map[string]string{
"reroute": "false",
},
},
ExpectedRequest: &http.ExpectedRequest{
Request: http.Request{
Host: "foo16.reroute.com",
Path: "/get",
Headers: map[string]string{"reroute": "true"},
},
},
},
Response: http.AssertionResponse{
ExpectedResponse: http.Response{
StatusCode: 200,
},
},
},
{
Meta: http.AssertionMeta{
TestCaseName: "case 17: request non reroute",
TargetBackend: "infra-backend-v1",
TargetNamespace: "higress-conformance-infra",
},
Request: http.AssertionRequest{
ActualRequest: http.Request{
Host: "foo17.com",
Path: "/get",
Headers: map[string]string{
"reroute": "false",
},
},
ExpectedRequest: &http.ExpectedRequest{
Request: http.Request{
Host: "foo17.non-reroute.com",
Path: "/get",
// although the header was replaced, it was not rerouted
Headers: map[string]string{"reroute": "true"},
},
},
},
Response: http.AssertionResponse{
ExpectedResponse: http.Response{
StatusCode: 200,
},
},
},
}
t.Run("WasmPlugin transformer", func(t *testing.T) {
for _, testcase := range testcases {