From ac86d9c5f17d8c4ba538a08d173794b5464b2a33 Mon Sep 17 00:00:00 2001 From: Noel Kwan <47273164+kwannoel@users.noreply.github.com> Date: Thu, 29 Feb 2024 09:21:44 +0800 Subject: [PATCH] fix(ci): add `wait_process_exit` in backwards compat test (#15326) --- backwards-compat-tests/scripts/utils.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/backwards-compat-tests/scripts/utils.sh b/backwards-compat-tests/scripts/utils.sh index 5990aac026077..3bbd9b06ca42c 100644 --- a/backwards-compat-tests/scripts/utils.sh +++ b/backwards-compat-tests/scripts/utils.sh @@ -49,6 +49,23 @@ kill_zookeeper() { wait_zookeeper_exit } +wait_for_process() { + process_name="$1" + + while pgrep -x "$process_name" > /dev/null; do + echo "Process $process_name is still running... Wait for 1 sec" + sleep 1 + done +} + +wait_all_process_exit() { + wait_for_process meta-node + wait_for_process compute-node + wait_for_process frontend + wait_for_process compactor + echo "All processes has exited." +} + # Older versions of RW may not gracefully kill kafka. # So we duplicate the definition here. kill_cluster() { @@ -75,6 +92,7 @@ kill_cluster() { tmux kill-session -t risedev test $? -eq 0 || { echo "Failed to stop all RiseDev components."; exit 1; } + wait_all_process_exit } run_sql () {