directory
Version:
v0.0.0-...-552cffb
Opens a new window with list of versions in this module.
Published: Sep 12, 2024
License: Apache-2.0
Opens a new window with license information.
README
¶
This folder contains all tests which relies on external service such as TiDB.
Preprations
-
The following three executables must be copied or linked into these locations:
bin/pd-server
bin/tikv-server
bin/tidb-server
bin/binlogctl
bin/sync_diff_inspector
-
The following programs must be installed:
mysql
(the CLI client)
kafka
working on default port 9092
-
The user executing the tests must have permission to create the folder
/tmp/tidb_binlog_test/pump
. All test artifacts will be written into this folder.
Running
Run make integration_test
to execute the integration tests. This command will
- Check that all executables exist.
- Build
pump
and drainer
- Execute
tests/run.sh
If the first two steps are done before, you could also run `tests/run.sh directly.
The scrip will
-
Start PD, TiKV, TiDB, Pump, Drainer in backgroud
-
Find out all tests/*/run.sh
and run it.
Run tests/run.sh --debug
to pause immediately after all servers are started.
Writing new tests
New integration tests can be written as shell script in tests/TEST_NAME/run.sh
.
The script should exit with a nonzero error code on failure.
Serveral convenient commands are provided:
-
run_drainer
Starts drainer
using tests/TEST_NAME/drainer.toml (notice it may continue at the checkpoint from the last test case)
-
run_sql <SQL>
Executes an SQL query on the TiDB database(port 4000)
-
down_run_sql <SQL>
Executes an SQL query on the downstream TiDB database(port 3306)
-
check_contains <TEXT>
— Checks if the previous run_sql
result contains the given text
(in -E
format)
-
check_not_contains <TEXT>
— Checks if the previous run_sql
result does not contain the given
text (in -E
format)
-
check_status <NODE_TYPE> <NODE_ID> <STATUS>
— Checks if the node's status is STATUS, if NODE_TYPE is 'drainer', don't need set the NODE_ID
-
check_data <CONFIG_FILE>
- Checks data between TiDB and downstream by sync_diff_inspector, this tool can download from tidb-enterprise-tools-latest-linux-amd64.tar.gz
Directories
¶
Click to show internal directories.
Click to hide internal directories.