github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/_utils/start_tls_tidb_cluster (about)

     1  #!/bin/bash
     2  
     3  # --workdir: work directory
     4  # --tlsdir: certificates directory
     5  # --retry: retry times
     6  
     7  set -e
     8  
     9  OUT_DIR=
    10  TLS_DIR=
    11  retry_times=3
    12  
    13  while [[ ${1} ]]; do
    14  	case "${1}" in
    15  	--workdir)
    16  		OUT_DIR=${2}
    17  		shift
    18  		;;
    19  	--tlsdir)
    20  		TLS_DIR=${2}
    21  		shift
    22  		;;
    23  	--retry)
    24  		retry_times=${2}
    25  		shift
    26  		;;
    27  	*)
    28  		echo "Unknown parameter: ${1}" >&2
    29  		exit 1
    30  		;;
    31  	esac
    32  
    33  	if ! shift; then
    34  		echo 'Missing parameter argument.' >&2
    35  		exit 1
    36  	fi
    37  done
    38  
    39  CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
    40  source $CUR/../_utils/test_prepare
    41  
    42  set +e
    43  i=1
    44  while [ $i -le $retry_times ]; do
    45  	echo "The ${i} times to try to start tls tidb cluster..."
    46  
    47  	start_tls_tidb_cluster_impl --workdir ${OUT_DIR} --tlsdir ${TLS_DIR}
    48  
    49  	if [ $? -eq 0 ]; then
    50  		break
    51  	fi
    52  	let i++
    53  	echo "start tls tidb cluster failed"
    54  done