From ca77aabeb84ba422bf3853c42eef127aaafffb19 Mon Sep 17 00:00:00 2001 From: Nick Porter Date: Wed, 1 Feb 2023 11:04:39 +0000 Subject: [PATCH] CI: Check that redis nodes are up before creating the cluster The create-cluster script starts redis-server with the --daemonize option and on slow CI hosts, this may not be fully ready if `start` is immediately followed by `create` --- scripts/ci/redis-setup.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/ci/redis-setup.sh b/scripts/ci/redis-setup.sh index 336649b7dad..7e16d633231 100755 --- a/scripts/ci/redis-setup.sh +++ b/scripts/ci/redis-setup.sh @@ -36,6 +36,18 @@ sed -ie "s# --appenddirname appendonlydir-\${PORT}##" "${TMP_REDIS_DIR}/create-c # Fix cleanup to match option change above sed -ie "s#appendonlydir-\*#appendonly\*.aof#" "${TMP_REDIS_DIR}/create-cluster" +# Ensure all nodes are accessible before creating cluster +if [ "$1" == "create" ]; then + waits=0 + for node in 30001 30002 30003 30004 30005 30006; do + while [ $waits -lt 10 ]; do + redis-cli -p $node quit > /dev/null && break + sleep 0.5 + waits=$((waits + 1)) + done + done +fi + # Again, not needed for CI, but useful for local testing if [ -z "$1" ]; then create-cluster start -- 2.47.3