-
Run
make prepare_test_binaries community=true
to download TiCDC related binaries for integration test. You can specify version and arch, for example:make prepare_test_binaries community=true ver=v7.0.0 arch=amd64
.You should find these executables in the
tiflow/bin
directory after downloading successfully.tidb-server
# version >= 6.0.0-rc.1tikv-server
# version >= 6.0.0-rc.1pd-server
# version >= 6.0.0-rc.1pd-ctl
# version >= 6.0.0-rc.1tiflash
# tiflash binarylibc++.so, libc++abi.so, libgmssl.so, libtiflash_proxy.so
# some necessary so files related to tiflashsync_diff_inspector
- go-ycsb
- etcdctl
- jq
- minio
You could download these binaries by yourself from tidb-community-toolkit and tidb-community-server.
-
These are programs/packages need be installed.
- mysql (the MySQL cli client, currently mysql client 8.0 is not supported)
- s3cmd
- unzip
- psmisc
You can install
unzip
andpsmisc
usingapt-get
(Ubuntu / Debian) oryum
(RHEL).Since the integration test cases will use port 3306 on localhost, please make sure in advance that port 3306 is not occupied. (You’d like to stop the local MySQL service on port 3306, if there is one)
-
The user used to execute the tests must have permission to create the folder /tmp/tidb_cdc_test. All test artifacts will be written into this folder.
The following programs must be installed:
We recommend that you provide docker with at least 6+ cores and 8G+ memory. Of course, the more resources, the better.
- Unit test does not need any dependencies, just running
make unit_test
in root dir of source code, or cd into directory of a test case and run single case viaGO111MODULE=on go test -check.f TestXXX
.
Warning: These scripts and files may not work under the arm architecture, and we have not tested against it. We will try to resolve it as soon as possible.
The script is designed to download necessary binaries from the PingCAP intranet by default, requiring access to the PingCAP intranet. However, if you want to download the community version, you can specify it through the
COMMUNITY
environment variable. For instance, you can use the following command as an example:BRANCH=master COMMUNITY=true VERSION=v7.0.0 START_AT="clustered_index" make kafka_docker_integration_test_with_build
-
If you want to run kafka tests, run
START_AT="clustered_index" make kafka_docker_integration_test_with_build
-
If you want to run MySQL tests, run
CASE="clustered_index" make mysql_docker_integration_test_with_build
-
Use the command
make clean_integration_test_images
to clean up the corresponding environment.
Some useful tips:
-
The log files for the test are mounted in the
./deployments/ticdc/docker-compose/logs
directory. -
You can specify multiple tests to run in CASE, for example:
CASE="clustered_index kafka_messages"
. You can even useCASE="*"
to indicate that you are running all tests。 -
You can specify in the integration-test.Dockerfile the version of other dependencies that you want to download, such as tidb, tikv, pd, etc.
For example, you can change
RUN ./download-integration-test-binaries.sh master
toRUN ./download-integration-test-binaries.sh release-5.2
to use the release-5.2 dependency. Then rebuild the image withmake build_mysql_integration_test_images
.
-
Run
make integration_test_build
to generate TiCDC related binaries for integration test -
Run
make integration_test
to execute the integration tests. This command will- Check that all required executables exist.
- Execute
tests/integration_tests/run.sh
If want to run one integration test case only, just pass the CASE parameter, such as
make integration_test CASE=simple
.If want to run integration test cases from the specified one, just pass the START_AT parameter, such as
make integration_test START_AT=simple
.There exists some environment variables that you can set by yourself, variable details can be found in test_prepare.
MySQL sink
will be used by default, if you want to testKafka sink
, please run withmake integration_test_kafka CASE=simple
. -
After executing the tests, run
make coverage
to get a coverage report at/tmp/tidb_cdc_test/all_cov.html
.
-
New integration tests can be written as shell scripts in
tests/integration_tests/TEST_NAME/run.sh
. The script should exit with a nonzero error code on failure. -
Add TEST_NAME to existing group in run_group.sh, or add a new group for it.
-
If you add a new group, the name of the new group must be added to CI.