]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
CI: Check that redis nodes are up before creating the cluster
authorNick Porter <nick@portercomputing.co.uk>
Wed, 1 Feb 2023 11:04:39 +0000 (11:04 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Wed, 1 Feb 2023 18:40:32 +0000 (18:40 +0000)
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

index 336649b7dad068bc468e9b9bc154c6671ab51257..7e16d633231329194cb4859036f9f894106c0596 100755 (executable)
@@ -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