This folder contains all tests which relies on external service such as TiDB.
-
The following three executables must be copied or linked into these locations:
bin/pd-serverbin/tikv-serverbin/tidb-serverbin/binlogctlbin/sync_diff_inspector
-
The following programs must be installed:
mysql(the CLI client)kafkaworking 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.
Run make integration_test to execute the integration tests. This command will
- Check that all executables exist.
- Build
pumpanddrainer - 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.shand run it.Run
tests/run.sh --debugto pause immediately after all servers are started.
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_drainerStartsdrainerusing 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 previousrun_sqlresult contains the given text (in-Eformat) -
check_not_contains <TEXT>— Checks if the previousrun_sqlresult does not contain the given text (in-Eformat) -
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