Verify the functional correctness of data migration and dependency modules.
Currently, Native and Docker environments are supported.
Currently, you can use MySQL, PostgreSQL and openGuass databases.
Module path: shardingsphere-test/shardingsphere-test-e2e/shardingsphere-test-e2e-pipeline
.
${DOCKER-IMAGE}
refers to the name of a Docker mirror, such as mysql:8
. ${DATABASE-TYPE}
refers to database types.
Directory: src/test/resources/env
it-env.properties
: the startup parameters of integration testing.${DATABASE-TYPE}/server.yaml
: ShardingSphere-Proxy configuration file corresponding to the database.${DATABASE-TYPE}/initdb.sql
: The database initializes SQL.${DATABASE-TYPE}/*.cnf,*.conf
: Files ending with cnf or conf are database configuration files for Docker mount.common/command.xml
: The DistSQL used in the test.scenario/
: Store SQL in the test scenarios.Currently, all the test cases are directly inherited from BaseExtraSQLITCase
and indirectly inherited from BaseITCase
.
BaseITCase
: Provide generic methods for sub-class.BaseExtraSQLITCase
: Provide table creation and CRUD statement execution methods.Test case example: MySQLGeneralPipelineE2EIT. Functions included:
All property values of it-env.properties
can be introduced by the Maven command line -D
, and its priority is higher than that of the configuration file.
The user starts ShardingSphere-Proxy locally in advance, along with dependent configuration centers (such as ZooKeeper) and databases.
The port required for ShardingSphere-Proxy is 3307.
Take MySQL as an example, it-env.properties
can be configured as follows:
pipeline.it.env.type=NATIVE
pipeline.it.native.database=mysql
pipeline.it.native.mysql.username=root
pipeline.it.native.mysql.password=root
pipeline.it.native.mysql.port=3306
Find the appropriate test case and start it with Junit under the IDE.
Step 1: Package mirror.
./mvnw -B clean install -am -pl shardingsphere-test/shardingsphere-test-e2e/shardingsphere-test-e2e-pipeline -Pit.env.docker -DskipTests
Running the above command will build a Docker mirror apache/shardingsphere-proxy-test:latest used for integration testing. The mirror sets the port for remote debugging and the default port is 3308. If only the test code is modified, you can reuse the existing test mirror without rebuilding it.
If you need to adjust Docker mirror startup parameters, you can modify the configuration of the ShardingSphereProxyDockerContainer file.
The output log of ShardingSphere-Proxy has the prefix Pipeline-Proxy.
Use Maven to run the test cases. Take MySQL as an example:
./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-test-e2e/shardingsphere-test-e2e-pipeline/pom.xml -Dpipeline.it.env.type=DOCKER -Dpipeline.it.docker.mysql.version=${image-name}
You can also use IDE to run test cases. it-env.properties
can be configured as follows:
pipeline.it.env.type=DOCKER
pipeline.it.docker.mysql.version=mysql:5.7