mirror of
https://github.com/alibaba/higress.git
synced 2026-06-04 01:57:26 +08:00
feat: e2e test support http body check (#733)
This commit is contained in:
@@ -35,7 +35,7 @@ var WasmPluginsTransformer = suite.ConformanceTest{
|
||||
testcases := []http.Assertion{
|
||||
{
|
||||
Meta: http.AssertionMeta{
|
||||
TestCaseName: "case 1: request transformer",
|
||||
TestCaseName: "case 1: request header&query transformer",
|
||||
TargetBackend: "infra-backend-v1",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
},
|
||||
@@ -77,7 +77,7 @@ var WasmPluginsTransformer = suite.ConformanceTest{
|
||||
},
|
||||
{
|
||||
Meta: http.AssertionMeta{
|
||||
TestCaseName: "case 2: response transformer",
|
||||
TestCaseName: "case 2: response header&query transformer",
|
||||
TargetBackend: "infra-backend-v1",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
},
|
||||
@@ -111,6 +111,85 @@ var WasmPluginsTransformer = suite.ConformanceTest{
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Meta: http.AssertionMeta{
|
||||
TestCaseName: "case 4: request body transformer",
|
||||
TargetBackend: "infra-backend-v1",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Host: "foo4.com",
|
||||
Path: "/post",
|
||||
// TODO(Uncle-Justice) dedupe, replace的body插件逻辑有问题,暂跳过测试
|
||||
Method: "POST",
|
||||
Body: []byte(`
|
||||
{
|
||||
"X-removed":["v1", "v2"],
|
||||
"X-not-renamed":["v1"]
|
||||
}
|
||||
`),
|
||||
ContentType: http.ContentTypeApplicationJson,
|
||||
},
|
||||
ExpectedRequest: &http.ExpectedRequest{
|
||||
Request: http.Request{
|
||||
Host: "foo4.com",
|
||||
Path: "/post",
|
||||
// TODO(Uncle-Justice) dedupe, replace的body插件逻辑有问题,暂跳过测试
|
||||
Method: "POST",
|
||||
ContentType: http.ContentTypeApplicationJson,
|
||||
Body: []byte(`
|
||||
{
|
||||
"X-renamed":["v1"],
|
||||
"X-add-append":["add","append"],
|
||||
"X-map":["add","append"]
|
||||
}
|
||||
`),
|
||||
},
|
||||
},
|
||||
},
|
||||
Response: http.AssertionResponse{
|
||||
ExpectedResponse: http.Response{
|
||||
StatusCode: 200,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Meta: http.AssertionMeta{
|
||||
TestCaseName: "case 5: response json body transformer",
|
||||
TargetBackend: "infra-backend-echo-body-v1",
|
||||
TargetNamespace: "higress-conformance-infra",
|
||||
CompareTarget: http.CompareTargetResponse,
|
||||
},
|
||||
Request: http.AssertionRequest{
|
||||
ActualRequest: http.Request{
|
||||
Host: "foo5.com",
|
||||
Path: "/post",
|
||||
// TODO(Uncle-Justice) dedupe, replace的body插件逻辑有问题,暂跳过测试
|
||||
Method: "POST",
|
||||
Body: []byte(`
|
||||
{
|
||||
"X-removed":["v1", "v2"],
|
||||
"X-not-renamed":["v1"]
|
||||
}
|
||||
`),
|
||||
ContentType: http.ContentTypeApplicationJson,
|
||||
},
|
||||
},
|
||||
Response: http.AssertionResponse{
|
||||
ExpectedResponse: http.Response{
|
||||
StatusCode: 200,
|
||||
ContentType: http.ContentTypeApplicationJson,
|
||||
Body: []byte(`
|
||||
{
|
||||
"X-renamed":["v1"],
|
||||
"X-add-append":["add","append"],
|
||||
"X-map":["add","append"]
|
||||
}
|
||||
`),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
t.Run("WasmPlugin transformer", func(t *testing.T) {
|
||||
for _, testcase := range testcases {
|
||||
|
||||
Reference in New Issue
Block a user