Skip to content

Commit

Permalink
fix flaky it http_api (#351)
Browse files Browse the repository at this point in the history
Signed-off-by: Ping Yu <yuping@pingcap.com>
  • Loading branch information
pingyu authored Aug 25, 2023
1 parent 9b4dc22 commit 95dc443
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
11 changes: 8 additions & 3 deletions cdc/tests/integration_tests/_utils/start_tidb_cluster
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tidb_config=
pd_config=
retry_times=10
multiple_upstream_pd="false"
tikv_count=3

while [[ ${1-} ]]; do
case "${1}" in
Expand All @@ -34,6 +35,10 @@ while [[ ${1-} ]]; do
multiple_upstream_pd=${2}
shift
;;
--tikv-count)
tikv_count=${2}
shift
;;
*)
echo "Unknown parameter: ${1}" >&2
exit 1
Expand All @@ -55,11 +60,11 @@ while [ $i -le "$retry_times" ]; do
echo "The ${i} times to try to start tidb cluster..."

if [[ "$tidb_config" != "" ]]; then
start_tidb_cluster_impl --workdir "${OUT_DIR}" --multiple-upstream-pd "${multiple_upstream_pd}" --tidb-config "${tidb_config}"
start_tidb_cluster_impl --workdir "${OUT_DIR}" --multiple-upstream-pd "${multiple_upstream_pd}" --tidb-config "${tidb_config}" --tikv-count "${tikv_count}"
elif [[ "$pd_config" != "" ]]; then
start_tidb_cluster_impl --workdir "${OUT_DIR}" --multiple-upstream-pd "${multiple_upstream_pd}" --pd-config "${pd_config}"
start_tidb_cluster_impl --workdir "${OUT_DIR}" --multiple-upstream-pd "${multiple_upstream_pd}" --pd-config "${pd_config}" --tikv-count "${tikv_count}"
else
start_tidb_cluster_impl --workdir "${OUT_DIR}" --multiple-upstream-pd "${multiple_upstream_pd}"
start_tidb_cluster_impl --workdir "${OUT_DIR}" --multiple-upstream-pd "${multiple_upstream_pd}" --tikv-count "${tikv_count}"
fi

if [ $? -eq 0 ]; then
Expand Down
8 changes: 7 additions & 1 deletion cdc/tests/integration_tests/_utils/start_tidb_cluster_impl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pd_config=
multiple_upstream_pd=
random_file_name=
verify_tidb=false
tikv_count=3

# Random generate the sockets config.
# Make sure we dont use the same sock.
Expand Down Expand Up @@ -47,6 +48,10 @@ while [[ ${1-} ]]; do
--verify-tidb)
vierfy_tidb=true
;;
--tikv-count)
tikv_count=${2}
shift
;;
*)
echo "Unknown parameter: ${1}" >&2
exit 1
Expand Down Expand Up @@ -168,6 +173,7 @@ cat - >"$OUT_DIR/tikv-config.toml" <<EOF
reserve-space = "0MB"
api-version = 2
enable-ttl = true
capacity = "1MB"
[rocksdb]
max-open-files = 4096
[raftdb]
Expand All @@ -189,7 +195,7 @@ EOF
fi

echo "Starting Upstream TiKV..."
for idx in $(seq 1 3); do
for idx in $(seq 1 "$tikv_count"); do
host="UP_TIKV_HOST_$idx"
port="UP_TIKV_PORT_$idx"
status_port="UP_TIKV_STATUS_PORT_$idx"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ api-version = 2
enable-ttl = true
# Disable creating a large temp file.
reserve-space = "0MB"
capacity = "1MB"
[rocksdb]
max-open-files = 4096
[raftdb]
Expand Down
2 changes: 1 addition & 1 deletion cdc/tests/integration_tests/http_api/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function run() {

rm -rf $WORK_DIR && mkdir -p $WORK_DIR

start_tidb_cluster --workdir $WORK_DIR
start_tidb_cluster --workdir $WORK_DIR --tikv-count 1
start_tls_tidb_cluster --workdir $WORK_DIR --tlsdir $TLS_DIR

cd $WORK_DIR
Expand Down

0 comments on commit 95dc443

Please sign in to comment.