54 lines
1.2 KiB
Bash
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
|