github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/engine/test/integration_tests/dm_lightning_checkpoint/run.sh (about) 1 #!/bin/bash 2 3 set -eu 4 5 WORK_DIR=$OUT_DIR/$TEST_NAME 6 CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 7 8 CONFIG="$DOCKER_COMPOSE_DIR/3m3e_with_s3.yaml $DOCKER_COMPOSE_DIR/dm_databases.yaml" 9 CONFIG=$(adjust_config $OUT_DIR $TEST_NAME $CONFIG) 10 echo "using adjusted configs to deploy cluster: $CONFIG" 11 12 function run() { 13 start_engine_cluster $CONFIG 14 wait_mysql_online.sh --port 3306 15 wait_mysql_online.sh --port 3307 16 wait_mysql_online.sh --port 4000 17 18 # prepare MySQL global variables and data 19 run_sql_file --port 3306 $CUR_DIR/data/db1.prepare.sql 20 run_sql_file --port 3307 $CUR_DIR/data/db2.prepare.sql 21 22 # create job & wait for job finished 23 job_id=$(create_job "DM" "$CUR_DIR/conf/job.yaml" "checkpoint") 24 job_id2=$(create_job "DM" "$CUR_DIR/conf/job2.yaml" "checkpoint2") 25 exec_with_retry --count 100 "curl \"http://127.0.0.1:10245/api/v1/jobs/$job_id\" | tee /dev/stderr | jq -e '.state == \"Finished\"'" 26 exec_with_retry --count 100 "curl \"http://127.0.0.1:10245/api/v1/jobs/$job_id2\" | tee /dev/stderr | jq -e '.state == \"Finished\"'" 27 # clean the lighting checkpoint in downstream after job is finished 28 exec_with_retry --count 30 '! run_sql --port 4000 "show databases;" | grep -q "checkpoint"' 29 exec_with_retry --count 30 '! run_sql --port 4000 "show databases;" | grep -q "checkpoint2"' 30 31 # check data 32 check_sync_diff $WORK_DIR $CUR_DIR/conf/diff_config.toml 33 34 # check resource is cleaned 35 mc alias set myminio http://127.0.0.1:9000 engine engineSecret 36 mc find myminio --name metadata | wc -l | grep -q 0 37 } 38 39 trap "stop_engine_cluster $WORK_DIR $CONFIG" EXIT 40 run $* 41 echo "[$(date)] <<<<<< run test case $TEST_NAME success! >>>>>>"