Skip to content

Commit 35c324f

Browse files
committed
Fix wait
1 parent decd7a9 commit 35c324f

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

cpp/src/arrow/flight/sql/odbc/tests/dremio/set_up_dremio_instance.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,22 @@ MAX_WAIT_ATTEMPTS=60
3131
WAIT_INTERVAL_SECONDS=5
3232

3333
# Wait for Dremio to be available.
34-
until curl -s "$NEW_USER_URL"; do
35-
echo 'Waiting for Dremio to start...'
36-
sleep $WAIT_INTERVAL_SECONDS
34+
attempt=1
35+
until status_code="$(
36+
curl --silent \
37+
--output /dev/null \
38+
--write-out '%{http_code}' \
39+
"$NEW_USER_URL"
40+
)"; [[ "$status_code" == "200" || "$status_code" == "404" || "$status_code" == "405" ]]; do
41+
42+
if [[ "$attempt" -ge "$MAX_WAIT_ATTEMPTS" ]]; then
43+
echo "Timed out waiting for Dremio to start." >&2
44+
exit 1
45+
fi
46+
47+
echo "Waiting for Dremio to start... HTTP $status_code"
48+
attempt=$((attempt + 1))
49+
sleep "$WAIT_INTERVAL_SECONDS"
3750
done
3851

3952
echo ""

0 commit comments

Comments
 (0)