Files
QSfera/Server/deployments/raspberry-pi/smoke-test.sh
T
Курнат Андрей e48e1e36a5
Android / test-and-build (push) Canceled after 0s
Server / deployment-config (push) Canceled after 0s
Server / vulnerability-scan (push) Canceled after 0s
Implement background media ingestion and Pi deployment
2026-07-15 22:58:03 +03:00

54 lines
1.2 KiB
Bash

#!/bin/sh
set -eu
cd "$(dirname "$0")"
case "$(uname -m)" in
aarch64|arm64) ;;
*)
echo "This profile requires a 64-bit ARM OS; uname -m returned $(uname -m)." >&2
exit 1
;;
esac
timeout_seconds=${SMOKE_TIMEOUT_SECONDS:-180}
started_at=$(date +%s)
docker compose config --quiet
docker compose up -d
container_id=$(docker compose ps -q qsfera)
if [ -z "$container_id" ]; then
echo "QSfera container was not created." >&2
exit 1
fi
while :; do
state=$(docker inspect --format '{{.State.Status}}' "$container_id")
if [ "$state" != "running" ]; then
docker compose logs --tail=100 qsfera >&2
echo "QSfera container state is $state." >&2
exit 1
fi
health=$(docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}missing{{end}}' "$container_id")
case "$health" in
healthy)
echo "QSfera container is healthy."
exit 0
;;
unhealthy)
docker compose logs --tail=100 qsfera >&2
exit 1
;;
esac
now=$(date +%s)
if [ $((now - started_at)) -ge "$timeout_seconds" ]; then
docker compose logs --tail=100 qsfera >&2
echo "QSfera did not become healthy within ${timeout_seconds}s." >&2
exit 1
fi
sleep 2
done