[tests/tikv] Make TiKV playground setup more resilient (#3057)
This commit is contained in:
parent
06504873f6
commit
07a0087c1b
1 changed files with 39 additions and 29 deletions
|
@ -143,54 +143,64 @@ run_task = { name = ["start-tikv", "ci-api-integration-tikv-tests", "stop-tikv"]
|
|||
category = "CI - SERVICES"
|
||||
dependencies = ["build-surrealdb"]
|
||||
script = """
|
||||
#!/bin/bash -ex
|
||||
#!/bin/bash -ex
|
||||
|
||||
target/debug/surreal start ${_START_SURREALDB_PATH} --allow-all &>/tmp/surrealdb-${_TEST_API_ENGINE}.log &
|
||||
target/debug/surreal start ${_START_SURREALDB_PATH} --allow-all &>/tmp/surrealdb-${_TEST_API_ENGINE}.log &
|
||||
|
||||
echo $! > /tmp/surreal-${_TEST_API_ENGINE}.pid
|
||||
echo $! > /tmp/surreal-${_TEST_API_ENGINE}.pid
|
||||
|
||||
set +e
|
||||
echo "Waiting for surreal to be ready..."
|
||||
tries=0
|
||||
while [[ $tries < 5 ]]; do
|
||||
target/debug/surreal is-ready 2>/dev/null && echo "Ready!" && exit 0 || sleep 1
|
||||
tries=$((tries + 1))
|
||||
done
|
||||
set +e
|
||||
echo "Waiting for surreal to be ready..."
|
||||
tries=0
|
||||
while [[ $tries < 5 ]]; do
|
||||
target/debug/surreal is-ready 2>/dev/null && echo "Ready!" && exit 0 || sleep 1
|
||||
tries=$((tries + 1))
|
||||
done
|
||||
|
||||
echo "ERROR: Surreal is unhealthy!"
|
||||
exit 1
|
||||
echo "ERROR: Surreal is unhealthy!"
|
||||
exit 1
|
||||
"""
|
||||
|
||||
[tasks.stop-surrealdb]
|
||||
category = "CI - SERVICES"
|
||||
script = """
|
||||
kill $(cat /tmp/surreal-${_TEST_API_ENGINE}.pid) || true
|
||||
sleep 5
|
||||
kill -9 $(cat /tmp/surreal-${_TEST_API_ENGINE}.pid) || true
|
||||
kill $(cat /tmp/surreal-${_TEST_API_ENGINE}.pid) || true
|
||||
sleep 5
|
||||
kill -9 $(cat /tmp/surreal-${_TEST_API_ENGINE}.pid) || true
|
||||
"""
|
||||
|
||||
[tasks.start-tikv]
|
||||
category = "CI - SERVICES"
|
||||
script = """
|
||||
#!/bin/bash -ex
|
||||
#!/bin/bash -ex
|
||||
|
||||
${HOME}/.tiup/bin/tiup install pd tikv playground
|
||||
${HOME}/.tiup/bin/tiup install pd tikv playground
|
||||
|
||||
${HOME}/.tiup/bin/tiup playground --mode tikv-slim --kv 3 --without-monitor &>/tmp/tiup.log &
|
||||
playground_attempts=0
|
||||
while [[ $playground_attempts < 5 ]]; do
|
||||
nohup ${HOME}/.tiup/bin/tiup playground --mode tikv-slim --kv 3 --without-monitor > /tmp/tiup.log &
|
||||
|
||||
echo $! > /tmp/tiup.pid
|
||||
echo $! > /tmp/tiup.pid
|
||||
|
||||
set +e
|
||||
echo "Waiting for tiup playground to be ready..."
|
||||
tries=0
|
||||
while [[ $tries < 10 ]]; do
|
||||
${HOME}/.tiup/bin/tiup playground display >/dev/null && echo "Ready!" && exit 0 || sleep 5
|
||||
tries=$((tries + 1))
|
||||
done
|
||||
set -e
|
||||
set +e
|
||||
echo "Waiting for tiup playground to be ready..."
|
||||
tries=0
|
||||
while [[ $tries < 10 ]]; do
|
||||
${HOME}/.tiup/bin/tiup playground display >/dev/null && echo "Ready!" && exit 0 || sleep 5
|
||||
tries=$((tries + 1))
|
||||
done
|
||||
set -e
|
||||
|
||||
echo "ERROR: TiUP Playground is unhealthy!"
|
||||
exit 1
|
||||
echo "ERROR: TiUP Playground is unhealthy! Try again..."
|
||||
kill $(cat /tmp/tiup.pid) || true
|
||||
|
||||
playground_attempts=$((playground_attempts + 1))
|
||||
done
|
||||
|
||||
echo "PANIC: Couldn't start tiup playground! Here are the logs for the last attempt:"
|
||||
cat /tmp/tiup.log
|
||||
|
||||
exit 1
|
||||
"""
|
||||
|
||||
[tasks.stop-tikv]
|
||||
|
|
Loading…
Reference in a new issue