Skip to content

Commit 5176fa0

Browse files
committed
[OPS-1049] wait scripts should exit with 1 if service is not up after retries
1 parent 7d482fd commit 5176fa0

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

filesystem/usr/local/share/landoop/wait-scripts/wait-for-connect.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ for ((i=0;i<$W_ITERATIONS;i++)); do
1212
# random wait. It isn't a great solution, but it may help.
1313
curl -sS "${W_CONNECT_ADDRESS}/connector-plugins/" \
1414
| grep "org.apache.kafka.connect.file.FileStreamSourceConnector" \
15-
&& { sleep $(( RANDOM%(5*W_PERIOD_SECS) )); break; }
15+
&& { sleep $(( RANDOM%(5*W_PERIOD_SECS) )); exit 0; }
1616
done
1717

18+
exit 1

filesystem/usr/local/share/landoop/wait-scripts/wait-for-kafka.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
W_ITERATIONS=${W_ITERATIONS:-60}
44
W_PERIOD_SECS=${W_PERIOD_SECS:-2}
5+
W_ALLOW_FAIL=${W_ALLOW_FAIL:-0}
56
W_BROKERS_WANTED=${W_BROKERS_WANTED:-1}
67
W_ZK_ADDRESS=${W_ZK_ADDRESS:-127.0.0.1}
78
W_ZK_PORT=${W_ZK_PORT:-$ZK_PORT}
@@ -13,7 +14,8 @@ for ((i=0;i<$W_ITERATIONS;i++)); do
1314
echo "Brokers detected/wanted: $_BROKER_NUM / $W_BROKERS_WANTED"
1415
if [[ ${_BROKER_NUM} -ge ${W_BROKERS_WANTED} ]]; then
1516
sleep 1
16-
break
17+
exit 0
1718
fi
1819
done
1920

21+
exit 1

filesystem/usr/local/share/landoop/wait-scripts/wait-for-registry.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ W_SR_ADDRESS=${W_SR_ADDRESS:-http://127.0.0.1:$REGISTRY_PORT}
66

77
for ((i=0;i<$W_ITERATIONS;i++)); do
88
sleep $W_PERIOD_SECS
9-
curl -sS "$W_SR_ADDRESS" | grep "{}" && break
9+
curl -sS "$W_SR_ADDRESS" | grep "{}" && exit 0
1010
done
1111

12+
exit 1

filesystem/usr/local/share/landoop/wait-scripts/wait-for-zookeeper.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ W_ZK_PORT=${W_ZK_PORT:-2181}
88

99
for ((i=0;i<$W_ITERATIONS;i++)); do
1010
sleep $W_PERIOD_SECS
11-
echo ruok | nc $W_ZK_ADDRESS $W_ZK_PORT | grep imok && break
11+
echo ruok | nc $W_ZK_ADDRESS $W_ZK_PORT | grep imok && exit 0
1212
done
1313

14+
exit 1

0 commit comments

Comments
 (0)