Перенести решение лабораторной 1 как основу для лабораторной 2
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# Waits until GET /health/ready answers 200 or the attempt budget runs out.
|
||||
# Usage: BASE_URL=http://localhost:8080 ATTEMPTS=60 sh student-tests/wait-ready.sh
|
||||
set -eu
|
||||
BASE_URL=${BASE_URL:-http://localhost:8080}
|
||||
ATTEMPTS=${ATTEMPTS:-60}
|
||||
i=0
|
||||
while [ "$i" -lt "$ATTEMPTS" ]; do
|
||||
if curl -sf "$BASE_URL/health/ready" >/dev/null 2>&1; then
|
||||
echo "ready: $BASE_URL"
|
||||
exit 0
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 0.5
|
||||
done
|
||||
echo "not ready after $ATTEMPTS attempts: $BASE_URL" >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user