There are two key points:
- Using docker compose to build a test environment. We start MySQL, database, redis and other dependencies in docker;
- Writing integrated tests under
shenyu-integrated-tests/src/test
.
You must install Docker!
If you are using windows, please notice that
-
is an invalid operator for terminals
Run those steps under this project's root directory
- Build
dist
from source, run this command under root directory:
./mvnw -B clean install -Prelease,docker -Dmaven.javadoc.skip=true -Dmaven.test.skip=true
- Build the examples' docker, here is the
http
plugin example:
./mvnw -B clean install -DskipTests -f ./shenyu-examples/shenyu-examples-http/pom.xml
- Build integrated gateway:
./mvnw -B clean install -DskipTests -f ./shenyu-integrated-test/shenyu-integrated-test-http/pom.xml
- Start the docker compose:
docker-compose -f ./shenyu-integrated-test/shenyu-integrated-test-http/docker-compose.yml up -d
On mac, you could
docker compose
, but if you are using ubuntu, you'd better usingdocker-compose
- Run the integrated test
./mvnw test -f ./shenyu-integrated-test/shenyu-integrated-test-http/pom.xml
That's the easy case!
You just need to do those steps:
-
(Optional) Update gateway configure. The configure file is under
shenyu-integated-test-{plugin}/src/main/resources/application-local.yml
-
Writing new test cases under
shenyu-integated-test-{plugin}/src/test
.
In this case, we didn't write tests for this plugin, so you need to setup the environment by yourself.
The name should be shenyu-integrated-test-{plugin}
.
You should read the shenyu's documents and add dependencies to pom.xml
file.
Write Dockerfile
for this module. We will use this module's image to star up docker compose.
In this step you could copy other plugins' Dockerfile
and update it.
We are using shenyu-examples
module as the backend behind gateway. So you need to write Dockerfile
for your plugin's example module.
You could copy other plugins' docker-compose
file. Update the image of example's image and gateway's image
Now, we can request related path in PluginController
in shenyu-web
to modify the configuration of shenyu gateway.
You could extends AbstractPluginDataInit
and call method in AbstractPluginDataInit
to change the configuration in shenyu.
However, pls remember to clean after class.
Writing tests under shenyu-integated-test-{plugin}/src/test
. You must run test locally before you commit your changes.
You could copy other plugins' YAML file and then update the plugin name. And then you could make PR for us.