Harden Immich restore smoke checks

This commit is contained in:
2026-05-27 18:25:30 +02:00
parent a805f03481
commit 5b0782a8fa
2 changed files with 20 additions and 2 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ require_path() {
}
latest_archive_name() {
docker exec "$BORG_CONTAINER" python3 - <<'PY'
docker exec -i "$BORG_CONTAINER" python3 - <<'PY'
import sqlite3
conn = sqlite3.connect('/data/borg.db')
cur = conn.cursor()
@@ -34,7 +34,7 @@ PY
}
borg_repo_url() {
docker exec "$BORG_CONTAINER" python3 - <<'PY'
docker exec -i "$BORG_CONTAINER" python3 - <<'PY'
import sqlite3
conn = sqlite3.connect('/data/borg.db')
cur = conn.cursor()
+18
View File
@@ -79,6 +79,11 @@ mkdir -p "$RESTORE_ROOT/postgres" "$RESTORE_ROOT/upload" "$RESTORE_ROOT/dumps/la
archive="$(latest_archive_name)"
repo="$(borg_repo_url)"
if [ -z "$archive" ] || [ -z "$repo" ]; then
echo "Could not resolve Borg repo/archive from borg-ui database" >&2
exit 1
fi
borg_extract "/restore/immich-extract" \
"local/borg-dumps/latest/immich.dump"
@@ -159,6 +164,19 @@ if ! grep -qiE "immich|login|signin" /tmp/immich-body.html 2>/dev/null; then
body_check="missing-marker"
fi
if [ "$http_status" != "200" ] && [ "$http_status" != "302" ] && [ "$http_status" != "303" ]; then
echo "Immich HTTP smoke failed: status=$http_status" >&2
docker ps -a --filter name=restoretest-immich >&2 || true
docker logs --tail 120 restoretest-immich-server >&2 || true
exit 1
fi
if [ "$body_check" != "ok" ]; then
echo "Immich HTTP smoke failed: body marker=$body_check" >&2
docker logs --tail 120 restoretest-immich-server >&2 || true
exit 1
fi
# Asset-Count aus DB. Wenn die Spalte nicht existiert (Schema-Drift),
# wird das im Report sichtbar gemacht statt das Skript zu killen.
asset_count="$(docker exec restoretest-immich-postgres \