github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/canal_json_storage_basic/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  WORK_DIR=$OUT_DIR/$TEST_NAME
     8  CDC_BINARY=cdc.test
     9  SINK_TYPE=$1
    10  
    11  function run() {
    12  	if [ "$SINK_TYPE" != "storage" ]; then
    13  		return
    14  	fi
    15  
    16  	rm -rf $WORK_DIR && mkdir -p $WORK_DIR
    17  	start_tidb_cluster --workdir $WORK_DIR
    18  	cd $WORK_DIR
    19  	run_cdc_server --workdir $WORK_DIR --binary $CDC_BINARY
    20  
    21  	# Enable tidb extension to generate the commit ts.
    22  	SINK_URI="file://$WORK_DIR/storage_test?flush-interval=5s&enable-tidb-extension=true"
    23  	run_cdc_cli changefeed create --sink-uri="$SINK_URI" --config=$CUR/conf/changefeed.toml
    24  
    25  	run_sql_file $CUR/data/schema.sql ${UP_TIDB_HOST} ${UP_TIDB_PORT}
    26  	run_sql_file $CUR/data/data.sql ${UP_TIDB_HOST} ${UP_TIDB_PORT}
    27  	run_storage_consumer $WORK_DIR $SINK_URI $CUR/conf/changefeed.toml ""
    28  	sleep 8
    29  	check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml 100
    30  }
    31  
    32  trap stop_tidb_cluster EXIT
    33  run $*
    34  check_logs $WORK_DIR
    35  echo "[$(date)] <<<<<< run test case $TEST_NAME success! >>>>>>"