Skip to content

Commit 35510e1

Browse files
Merge pull request #6996 from rabbitmq/mergify/bp/v3.11.x/pr-6994
2 parents ece177f + 91a5ddb commit 35510e1

File tree

1 file changed

+20
-14
lines changed
  • deps/rabbitmq_peer_discovery_etcd/test/system_SUITE_data

1 file changed

+20
-14
lines changed

deps/rabbitmq_peer_discovery_etcd/test/system_SUITE_data/init-etcd.sh

+20-14
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ case "$(uname -s)" in
2626
;;
2727
esac
2828

29-
etcd_data_dir=${1:-"$tmpdir/etcd/data"}
30-
pidfile="$etcd_data_dir/etcd.pid"
31-
tcp_port=${2:-2379}
29+
readonly etcd_data_dir="${1:-"$tmpdir/etcd/data"}"
30+
readonly pidfile="$etcd_data_dir/etcd.pid"
31+
readonly tcp_port="${2:-2379}"
3232

33-
ETCD_VER=v3.4.6
34-
35-
GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
36-
DOWNLOAD_URL=${GITHUB_URL}
33+
readonly ETCD_VER='v3.5.7'
34+
readonly GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
35+
readonly DOWNLOAD_URL=${GITHUB_URL}
3736

3837
rm -rf "${tmpdir}/etcd-${ETCD_VER}"
3938

@@ -60,7 +59,7 @@ rm -rf "$etcd_data_dir"
6059
mkdir -p "$etcd_data_dir"
6160

6261
# daemonize(1) is installed under this path on Debian
63-
PATH=$PATH:/usr/sbin
62+
PATH="$PATH:/usr/sbin"
6463

6564
daemonize -p "$pidfile" -l "${etcd_data_dir}/daemonize_lock" -- "$tmpdir/etcd-${ETCD_VER}/etcd" \
6665
--data-dir "$etcd_data_dir" --name peer-discovery-0 --initial-advertise-peer-urls http://127.0.0.1:2380 \
@@ -71,11 +70,18 @@ daemonize -p "$pidfile" -l "${etcd_data_dir}/daemonize_lock" -- "$tmpdir/etcd-${
7170
--initial-cluster peer-discovery-0=http://127.0.0.1:2380 \
7271
--initial-cluster-state new
7372

74-
75-
for seconds in {1..30}; do
76-
"$tmpdir/etcd-${ETCD_VER}/etcdctl" put rabbitmq-ct rabbitmq-ct --dial-timeout=1s && break
77-
sleep 1
73+
i=0
74+
while [ "$i" -lt 30 ]
75+
do
76+
"$tmpdir/etcd-${ETCD_VER}/etcdctl" --endpoints="127.0.0.1:${tcp_port}" put rabbitmq-ct rabbitmq-ct --dial-timeout=1s && break
77+
sleep 1
78+
i="$((i+1))"
7879
done
7980

80-
echo ETCD_PID=$(cat "$pidfile")
81-
81+
if [ "$i" -ge 30 ]
82+
then
83+
echo '[ERROR] etcd did not start successfully!' 1>&2
84+
exit 1
85+
else
86+
echo ETCD_PID="$(cat "$pidfile")"
87+
fi

0 commit comments

Comments
 (0)