github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/csv_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  	SINK_URI="file://$WORK_DIR/storage_test?flush-interval=5s"
    22  	run_cdc_cli changefeed create --sink-uri="$SINK_URI" --config=$CUR/conf/changefeed.toml
    23  
    24  	run_sql_file $CUR/data/schema.sql ${UP_TIDB_HOST} ${UP_TIDB_PORT}
    25  	run_sql_file $CUR/data/data.sql ${UP_TIDB_HOST} ${UP_TIDB_PORT}
    26  	run_storage_consumer $WORK_DIR $SINK_URI $CUR/conf/changefeed.toml ""
    27  	sleep 8
    28  	check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml 100
    29  }
    30  
    31  trap stop_tidb_cluster EXIT
    32  run $*
    33  check_logs $WORK_DIR
    34  echo "[$(date)] <<<<<< run test case $TEST_NAME success! >>>>>>"