Skip to content

Commit de3fd40

Browse files
committed
Fix edge case where wait-scripts would return 1 instead of 0
When W_ITERATIONS is equal to 0, the wait scripts should return exit code 0 Signed-off-by: Marios Andreopoulos <opensource@andmarios.com>
1 parent 5176fa0 commit de3fd40

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ for ((i=0;i<$W_ITERATIONS;i++)); do
1515
&& { sleep $(( RANDOM%(5*W_PERIOD_SECS) )); exit 0; }
1616
done
1717

18-
exit 1
18+
if [[ $W_ITERATIONS == 0 ]]; then
19+
exit 0
20+
else
21+
exit 1
22+
fi

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
W_ITERATIONS=${W_ITERATIONS:-60}
44
W_PERIOD_SECS=${W_PERIOD_SECS:-2}
5-
W_ALLOW_FAIL=${W_ALLOW_FAIL:-0}
65
W_BROKERS_WANTED=${W_BROKERS_WANTED:-1}
76
W_ZK_ADDRESS=${W_ZK_ADDRESS:-127.0.0.1}
87
W_ZK_PORT=${W_ZK_PORT:-$ZK_PORT}
@@ -18,4 +17,8 @@ for ((i=0;i<$W_ITERATIONS;i++)); do
1817
fi
1918
done
2019

21-
exit 1
20+
if [[ $W_ITERATIONS == 0 ]]; then
21+
exit 0
22+
else
23+
exit 1
24+
fi

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ for ((i=0;i<$W_ITERATIONS;i++)); do
99
curl -sS "$W_SR_ADDRESS" | grep "{}" && exit 0
1010
done
1111

12-
exit 1
12+
if [[ $W_ITERATIONS == 0 ]]; then
13+
exit 0
14+
else
15+
exit 1
16+
fi

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ for ((i=0;i<$W_ITERATIONS;i++)); do
1111
echo ruok | nc $W_ZK_ADDRESS $W_ZK_PORT | grep imok && exit 0
1212
done
1313

14-
exit 1
14+
if [[ $W_ITERATIONS == 0 ]]; then
15+
exit 0
16+
else
17+
exit 1
18+
fi

0 commit comments

Comments
 (0)