feat: ЛР 4 с хранением вложений в MinIO
This commit is contained in:
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
project_dir=$(dirname -- "$script_dir")
|
||||
cd "$project_dir"
|
||||
|
||||
restore() {
|
||||
docker compose --env-file .env up -d --wait --wait-timeout 60 s3 api lb >/dev/null
|
||||
}
|
||||
trap restore EXIT HUP INT TERM
|
||||
|
||||
docker compose --env-file .env stop s3 >/dev/null
|
||||
docker compose --env-file .env exec -T api python -c '
|
||||
import json
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
try:
|
||||
urllib.request.urlopen("http://127.0.0.1:8080/health/ready", timeout=25)
|
||||
except urllib.error.HTTPError as error:
|
||||
body = json.loads(error.read())
|
||||
assert error.code == 503, error.code
|
||||
assert body["error"]["code"] == "unavailable", body
|
||||
else:
|
||||
raise SystemExit("readiness unexpectedly succeeded while S3 was stopped")
|
||||
'
|
||||
|
||||
printf '%s\n' 'PASS: API readiness returned structured 503 while S3 was unavailable'
|
||||
Reference in New Issue
Block a user