We recommend that you provide docker with at least 6+ cores and 8G+ memory. Of course, the more resources, the better.
Running
Unit Test
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 via GO111MODULE=on go test -check.f TestXXX.
Integration Test
Run Integration Tests Locally
Run make integration_test to execute the integration tests. This command will
Download all required executables.
Check that all required executables exist.
Generate tikv-cdc binaries for integration test.
Execute tests/integration_tests/run.sh
If want to run one integration test case only, just pass the CASE parameter, e.g. make integration_test CASE=autorandom.
There are some environment variables that you can set by yourself, see test_prepare.
Run Integration Tests in Docker for TiKV Sink
Run tests/up.sh. This script will setup a container with some tools ready, and run /bin/bash interactively in the container.
Run make integration_test or make integration_test CASE=[test names] to execute the integration tests.
Warning:
These scripts and files may not work under the arm architecture,
and we have not tested against it.
Some useful tips:
You can specify multiple tests to run in CASE, for example: CASE="cli cli_tls". You can even
use CASE="*" to indicate that you are running all tests。
Run Integration Tests in Docker for Kafka Sink
Run tests/integration_tests/run_kafka_in_docker.sh --case [test names]. The rule of test names is the same with above.
Writing new tests
Write new integration tests 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.