diff --git a/tests/README.md b/tests/README.md index 6c64dae8190..29075d492e2 100644 --- a/tests/README.md +++ b/tests/README.md @@ -2,15 +2,37 @@ For running intergration test cases (defined in `./fullstack-test`, `./fullstack-test-dt`, `./new_collation_fullstack`), you should define a TiDB cluster with TiFlash node (1 PD, 1 TiKV, 1 TiDB, 1 TiFlash at least). -1. Deploy a cluster using [tiup](https://tiup.io/) -2. Use `ti.sh x.ti prop` to ensure the ports of your cluster -3. Change the "storage_port", "tidb_port" in `./env.sh` to let it connect to your cluster -4. Run tests with `./run-test.sh fullstack-test/ddl` +1. Install [tiup](https://tiup.io/) +2. Use `tiup playground` (recommanded) or `tiup cluster` to start a tidb cluster + +```bash +export TIDB_PORT=4000 +export TIFLASH_PORT=9000 + +# Prepare a config file with `tcp_port` enabled +cat << EOF > tiflash.toml +tcp_port = ${TIFLASH_PORT} +# If you're deploying a testing cluster where the disk is not exclusively dedicated to TiFlash, +# it is necessary to set "capacity". Otherwise, PD will not add peers to TiFlash, making the +# tiflash replica can not be available. +capacity = 1000000000 + +[logger] +level = "debug" +EOF + +# Start a tidb cluster with tiup playground +tiup playground nightly --tiflash 1 --tiflash.binpath /path/to/build/tiflash --db.port ${TIDB_PORT} --tiflash.config ./tiflash.toml + +# Run tests with `./run-test.sh`, for example +tidb_port=${TIDB_PORT} storage_port=${TIFLASH_PORT} verbose=true ./run-test.sh fullstack-test/ddl +``` ## How to run test cases in `delta-merge-test` For running mock test cases (defined in `./delta-merge-test`), you should start a standalone tiflash that is not connected to tidb cluster -``` + +```bash export TIFLASH_PORT=9000 ./tiflash server -- --path /tmp/tiflash/data --tcp_port ${TIFLASH_PORT} storage_port=${TIFLASH_PORT} verbose=true ./run-test.sh delta-merge-test diff --git a/tests/_env.sh b/tests/_env.sh index 8b47cdadff0..dc102a376ec 100644 --- a/tests/_env.sh +++ b/tests/_env.sh @@ -30,7 +30,7 @@ if [ -z ${storage_bin+x} ]; then fi # Server address for connecting -export storage_server="127.0.0.1" +export storage_server=${storage_server:-"127.0.0.1"} # Server port for connecting export storage_port=${storage_port:-9000} @@ -39,13 +39,13 @@ export storage_port=${storage_port:-9000} export storage_db="system" # TiDB address -export tidb_server="127.0.0.1" +export tidb_server=${tidb_server:-"127.0.0.1"} # TiDB port -export tidb_port="4000" +export tidb_port=${tidb_port:-"4000"} # TiDB status port -export tidb_status_port="10080" +export tidb_status_port=${tidb_status_port:-"10080"} # TiDB default database export tidb_db="test" @@ -54,8 +54,8 @@ export tidb_db="test" export tidb_table="t" # Whether run scripts with verbose output +# "true" or "false" export verbose=${verbose:-"false"} -# export verbose="true" export LANG=en_US.utf-8 export LC_ALL=en_US.utf-8 diff --git a/tests/docker/config/tiflash_dt.toml b/tests/docker/config/tiflash_dt.toml index 8a7d68b5b0d..085dae0bb17 100644 --- a/tests/docker/config/tiflash_dt.toml +++ b/tests/docker/config/tiflash_dt.toml @@ -17,15 +17,11 @@ tmp_path = "/tmp/tiflash/data/tmp" path = "/tmp/tiflash/data/db" capacity = "10737418240" -mark_cache_size = 1073741824 -minmax_index_cache_size = 1073741824 tcp_port = 9000 http_port = 8123 [flash] service_addr = "0.0.0.0:3930" -[flash.flash_cluster] -update_rule_interval = 5 [flash.proxy] addr = "0.0.0.0:20170" advertise-addr = "tiflash0:20170" diff --git a/tests/docker/config/tiflash_dt_disable_local_tunnel.toml b/tests/docker/config/tiflash_dt_disable_local_tunnel.toml index a1c85ced933..77775df344b 100644 --- a/tests/docker/config/tiflash_dt_disable_local_tunnel.toml +++ b/tests/docker/config/tiflash_dt_disable_local_tunnel.toml @@ -17,16 +17,12 @@ tmp_path = "/tmp/tiflash/data/tmp" path = "/tmp/tiflash/data/db" capacity = "10737418240" -mark_cache_size = 1073741824 -minmax_index_cache_size = 1073741824 tcp_port = 9000 http_port = 8123 [flash] tidb_status_addr = "tidb0:10080" service_addr = "0.0.0.0:3930" -[flash.flash_cluster] -update_rule_interval = 5 [flash.proxy] addr = "0.0.0.0:20170" advertise-addr = "tiflash0:20170" diff --git a/tests/docker/config/tiflash_dt_force_enable_lm.toml b/tests/docker/config/tiflash_dt_force_enable_lm.toml index 0c40d279d7c..20a6b522e04 100644 --- a/tests/docker/config/tiflash_dt_force_enable_lm.toml +++ b/tests/docker/config/tiflash_dt_force_enable_lm.toml @@ -17,16 +17,12 @@ tmp_path = "/tmp/tiflash/data/tmp" path = "/tmp/tiflash/data/db" capacity = "10737418240" -mark_cache_size = 5368709120 -minmax_index_cache_size = 5368709120 tcp_port = 9000 http_port = 8123 [flash] tidb_status_addr = "tidb0:10080" service_addr = "0.0.0.0:3930" -[flash.flash_cluster] -update_rule_interval = 5 [flash.proxy] addr = "0.0.0.0:20170" advertise-addr = "tiflash0:20170" diff --git a/tests/docker/config/tiflash_dt_sync_grpc.toml b/tests/docker/config/tiflash_dt_sync_grpc.toml index a1c85ced933..77775df344b 100644 --- a/tests/docker/config/tiflash_dt_sync_grpc.toml +++ b/tests/docker/config/tiflash_dt_sync_grpc.toml @@ -17,16 +17,12 @@ tmp_path = "/tmp/tiflash/data/tmp" path = "/tmp/tiflash/data/db" capacity = "10737418240" -mark_cache_size = 1073741824 -minmax_index_cache_size = 1073741824 tcp_port = 9000 http_port = 8123 [flash] tidb_status_addr = "tidb0:10080" service_addr = "0.0.0.0:3930" -[flash.flash_cluster] -update_rule_interval = 5 [flash.proxy] addr = "0.0.0.0:20170" advertise-addr = "tiflash0:20170"