github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/tests/new_collation_off/run.sh (about)

     1  #!/bin/bash
     2  
     3  set -eu
     4  
     5  cur=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
     6  source $cur/../_utils/test_prepare
     7  
     8  WORK_DIR=$TEST_DIR/$TEST_NAME
     9  
    10  API_VERSION="v1alpha1"
    11  
    12  # this case will change downstream TiDB not to use new collation. Following cases
    13  # should turn on new collation if they need.
    14  function run() {
    15  	pkill -hup tidb-server 2>/dev/null || true
    16  	wait_process_exit tidb-server
    17  
    18  	# clean unistore data
    19  	rm -rf /tmp/tidb
    20  
    21  	# start a TiDB with off new-collation
    22  	run_tidb_server 4000 $TIDB_PASSWORD $cur/conf/tidb-config.toml
    23  	sleep 2
    24  
    25  	run_dm_master $WORK_DIR/master $MASTER_PORT $cur/conf/dm-master.toml
    26  	check_rpc_alive $cur/../bin/check_master_online 127.0.0.1:$MASTER_PORT
    27  	run_dm_worker $WORK_DIR/worker1 $WORKER1_PORT $cur/conf/dm-worker1.toml
    28  	check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER1_PORT
    29  
    30  	dmctl_operate_source create $cur/conf/source2.yaml $SOURCE_ID2
    31  	run_sql_file $cur/data/db2.prepare.sql $MYSQL_HOST2 $MYSQL_PORT2 $MYSQL_PASSWORD2
    32  	check_contains 'Query OK, 1 row affected'
    33  
    34  	run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
    35  		"start-task $cur/conf/dm-task.yaml" \
    36  		"\"result\": true" 2
    37  
    38  	run_sql_file $cur/data/db2.increment.sql $MYSQL_HOST2 $MYSQL_PORT2 $MYSQL_PASSWORD2
    39  
    40  	echo "check data"
    41  	check_sync_diff $WORK_DIR $cur/conf/diff_config.toml
    42  }
    43  
    44  cleanup_data new_collation_off
    45  cleanup_process
    46  
    47  run $*
    48  
    49  cleanup_process
    50  
    51  echo "[$(date)] <<<<<< test case $TEST_NAME success! >>>>>>"