Repository navigation
Expand file tree
/
Copy pathboot_probe.sh
More file actions
executable file
·49 lines (41 loc) · 1.66 KB
/
Copy pathboot_probe.sh
File metadata and controls
executable file
·49 lines (41 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# Daemonless boot validation of the container runtime (agent-proxy#24).
#
# Reproduces exactly what the Dockerfile installs and runs - `uv sync --frozen
# --no-dev` then `python -m app.main` off the resulting .venv - and asserts the
# process binds, serves /healthz + /v1/models + /metrics, and stays up (no
# crash). This is the repeatable check for a box with NO Docker daemon (a ward
# feature container, a daemonless CI leg). test-container.sh is the full image
# build+run for a box that has a daemon; both share scripts/probe_endpoints.sh
# so the endpoint assertions are identical.
set -euo pipefail
cd "$(dirname "$0")"
PORT="${PORT:-8080}"
BASE_URL="http://127.0.0.1:${PORT}"
BOOT_LOG="$(mktemp -t agent-proxy-boot.XXXXXX.log)"
echo "=== uv sync --frozen --no-dev (the exact Dockerfile install path) ==="
uv sync --frozen --no-dev
PYTHON_BIN=".venv/bin/python"
if [ ! -x "$PYTHON_BIN" ]; then
PYTHON_BIN=".venv/Scripts/python.exe"
fi
echo "=== boot: ${PYTHON_BIN} -m app.main ==="
PROXY_HOST=127.0.0.1 PROXY_PORT="$PORT" "$PYTHON_BIN" -m app.main >"$BOOT_LOG" 2>&1 &
APP_PID=$!
cleanup() { kill "$APP_PID" 2>/dev/null || true; }
trap cleanup EXIT
echo "=== probe live endpoints ==="
if ! ./scripts/probe_endpoints.sh "$BASE_URL" 30; then
echo "ERROR: endpoint probe failed. Boot log:" >&2
tail -40 "$BOOT_LOG" >&2
exit 1
fi
echo "=== assert the process is still alive (no crash) ==="
if ! kill -0 "$APP_PID" 2>/dev/null; then
echo "ERROR: app process died. Boot log:" >&2
tail -40 "$BOOT_LOG" >&2
exit 1
fi
echo " OK pid ${APP_PID} still serving"
echo ""
echo "=== PASS: frozen runtime boots and serves /healthz + /v1/models + /metrics ==="