github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/engine/test/utils/adjust_config (about) 1 #!/bin/bash 2 3 # parameter 1: out directory 4 # parameter 2: test name which is used to generate the sub directory 5 # other parameters: deployment files 6 7 set -eu 8 9 if [ $# -lt 3 ]; then 10 echo "<<<<<< can not adjust empty config >>>>>>" 11 exit 1 12 fi 13 14 # 1. cleanup and init work directory. 15 OUT_DIR=$1 && shift 16 TEST_NAME=$1 && shift 17 WORK_DIR=$OUT_DIR/$TEST_NAME # typical working directory is /tmp/tiflow_engine_test/${test_name} 18 rm -rf $WORK_DIR && mkdir -p $WORK_DIR 19 20 # 2. move config files to working directory. 21 # CONFIG_DIR is directory where the deployment files are located, and it needs to contain a 22 # subdirectory `config` to store the additional configuration files. 23 CONFIG_DIR=$(dirname $1) 24 cp -fr ${CONFIG_DIR}/config ${WORK_DIR} || exit 1 25 26 # 3. generate new deploy files and replace `tmp/tiflow_engine_test` with 27 # `tmp/tiflow_engine_test/${TEST_NAME}` which is used to store log files. 28 new_configs= 29 while [[ $# -gt 0 ]]; do 30 old_path=$1 && shift 31 new_path="${WORK_DIR}/$(basename ${old_path})" 32 cat ${old_path} | sed -e "s, /tmp/tiflow_engine_test.*:, /tmp/tiflow_engine_test/${TEST_NAME}:, g" >${new_path} 33 new_configs="${new_configs} ${new_path}" 34 done 35 echo "$new_configs"