add tests
This commit is contained in:
+22
-2
@@ -2,5 +2,25 @@
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
docker compose restart postgres
|
||||
docker compose restart api
|
||||
compose() {
|
||||
docker compose --env-file .env "$@"
|
||||
}
|
||||
|
||||
wait_healthy() {
|
||||
for service in "$@"; do
|
||||
attempts=0
|
||||
until [ "$(compose ps --format '{{.Health}}' "$service")" = "healthy" ]; do
|
||||
attempts=$((attempts + 1))
|
||||
if [ "$attempts" -ge 60 ]; then
|
||||
echo "$service не стал healthy за 60 секунд" >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
compose restart postgres redis
|
||||
wait_healthy postgres redis
|
||||
compose restart api
|
||||
wait_healthy api
|
||||
|
||||
Reference in New Issue
Block a user