mirror of
https://github.com/alibaba/higress.git
synced 2026-06-06 11:17:29 +08:00
Wasm cpp bazel (#446)
This commit is contained in:
@@ -149,9 +149,9 @@ spec:
|
||||
当你完成一个GO语言的插件功能时, 可以同时创建关联的e2e test cases, 并在本地对插件功能完成测试验证。
|
||||
|
||||
### step1. 编写 test cases
|
||||
在目录./test/ingress/conformance下面, 分别添加xxx.yaml文件和xxx.go文件, 比如测试插件request-block
|
||||
在目录./test/e2e/conformance/tests/下面, 分别添加xxx.yaml文件和xxx.go文件, 比如测试插件request-block
|
||||
|
||||
./test/ingress/conformance/request-block.yaml
|
||||
./test/e2e/conformance/tests/request-block.yaml
|
||||
```
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
@@ -165,12 +165,12 @@ spec:
|
||||
```
|
||||
`其中url中extensions后面的'request-block'为插件所在文件夹名称`
|
||||
|
||||
./test/ingress/conformance/request-block.go
|
||||
./test/e2e/conformance/tests/request-block.go
|
||||
|
||||
### step2. 添加 test cases
|
||||
将上述所写test cases添加到e2e测试列表中,
|
||||
|
||||
./test/ingress/conformance/request-block.yaml
|
||||
./test/e2e/e2e_test.go
|
||||
|
||||
```
|
||||
...
|
||||
@@ -178,14 +178,21 @@ cSuite.Setup(t)
|
||||
var higressTests []suite.ConformanceTest
|
||||
|
||||
if *isWasmPluginTest {
|
||||
higressTests = []suite.ConformanceTest{
|
||||
tests.WasmPluginsRequestBlock,
|
||||
//这里新增你新写的case方法名称
|
||||
if strings.Compare(*wasmPluginType, "CPP") == 0 {
|
||||
m := make(map[string]suite.ConformanceTest)
|
||||
m["request_block"] = tests.CPPWasmPluginsRequestBlock
|
||||
m["key_auth"] = tests.CPPWasmPluginsKeyAuth
|
||||
|
||||
higressTests = []suite.ConformanceTest{
|
||||
m[*wasmPluginName],
|
||||
}
|
||||
} else {
|
||||
higressTests = []suite.ConformanceTest{
|
||||
tests.WasmPluginsRequestBlock,
|
||||
//这里新增你新写的case方法名称
|
||||
}
|
||||
}
|
||||
} else {
|
||||
higressTests = []suite.ConformanceTest{
|
||||
tests.HTTPRouteSimpleSameNamespace,
|
||||
tests.HTTPRouteHostNameSameNamespace,
|
||||
...
|
||||
```
|
||||
|
||||
@@ -193,5 +200,5 @@ cSuite.Setup(t)
|
||||
考虑到本地构建wasm比较耗时, 我们支持只构建需要测试的插件(同时你也可以临时修改上面第二小步的测试cases列表, 只执行你新写的case)。
|
||||
|
||||
```bash
|
||||
PLUGIN_NAME=request-block make ingress-wasmplugin-test
|
||||
PLUGIN_NAME=request-block make higress-wasmplugin-test
|
||||
```
|
||||
@@ -144,9 +144,9 @@ The rules will be matched in the order of configuration. If one match is found,
|
||||
When you complete a GO plug-in function, you can create associated e2e test cases at the same time, and complete the test verification of the plug-in function locally.
|
||||
|
||||
### step1. write test cases
|
||||
In the directory of `./ test/ingress/conformance`, add the xxx.yaml file and xxx.go file. Such as test for `request-block` wasm-plugin,
|
||||
In the directory of `./ test/e2e/conformance/tests/`, add the xxx.yaml file and xxx.go file. Such as test for `request-block` wasm-plugin,
|
||||
|
||||
./test/ingress/conformance/request-block.yaml
|
||||
./test/e2e/conformance/tests/request-block.yaml
|
||||
```
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
@@ -160,12 +160,12 @@ spec:
|
||||
```
|
||||
`Above of the url, the name of after extensions indicates the name of the folder where the plug-in resides.`
|
||||
|
||||
./test/ingress/conformance/request-block.go
|
||||
./test/e2e/conformance/tests/request-block.go
|
||||
|
||||
### step2. add test cases
|
||||
Add the test cases written above to the e2e test list,
|
||||
|
||||
./test/ingress/conformance/request-block.yaml
|
||||
./test/e2e/e2e_test.go
|
||||
|
||||
```
|
||||
...
|
||||
@@ -173,14 +173,21 @@ cSuite.Setup(t)
|
||||
var higressTests []suite.ConformanceTest
|
||||
|
||||
if *isWasmPluginTest {
|
||||
higressTests = []suite.ConformanceTest{
|
||||
tests.WasmPluginsRequestBlock,
|
||||
//Add your newly written case method name here
|
||||
if strings.Compare(*wasmPluginType, "CPP") == 0 {
|
||||
m := make(map[string]suite.ConformanceTest)
|
||||
m["request_block"] = tests.CPPWasmPluginsRequestBlock
|
||||
m["key_auth"] = tests.CPPWasmPluginsKeyAuth
|
||||
|
||||
higressTests = []suite.ConformanceTest{
|
||||
m[*wasmPluginName],
|
||||
}
|
||||
} else {
|
||||
higressTests = []suite.ConformanceTest{
|
||||
tests.WasmPluginsRequestBlock,
|
||||
//Add your newly written case method name here
|
||||
}
|
||||
}
|
||||
} else {
|
||||
higressTests = []suite.ConformanceTest{
|
||||
tests.HTTPRouteSimpleSameNamespace,
|
||||
tests.HTTPRouteHostNameSameNamespace,
|
||||
...
|
||||
```
|
||||
|
||||
@@ -188,5 +195,5 @@ cSuite.Setup(t)
|
||||
Considering that building wasm locally is time-consuming, we support building only the plug-ins that need to be tested (at the same time, you can also temporarily modify the list of test cases in the second small step above, and only execute your newly written cases).
|
||||
|
||||
```bash
|
||||
PLUGIN_NAME=request-block make ingress-wasmplugin-test
|
||||
PLUGIN_NAME=request-block make higress-wasmplugin-test
|
||||
```
|
||||
Reference in New Issue
Block a user