Documentation
¶
Overview ¶
dbcheck is a tiny Postgres query helper used by scripts/test.sh's --full-deploy suite to assert state-store rows after each lifecycle step. It is intentionally minimal: take a query, run it, print one row per line as tab-separated columns. The exit code reflects DB errors only — empty result sets are NOT failures (the bash caller decides what to assert).
Build:
cd apps/orchestrator && go build -o /tmp/dbcheck ./cmd/dbcheck
Use (DATABASE_URL must be set):
/tmp/dbcheck "SELECT vm_id, state FROM orchestrator_vms WHERE vm_id=$1" "fuse-foo" # → "fuse-foo running"
The helper prints column names as the first line when --headers is passed (handy for ad-hoc debugging), otherwise just data rows. NULL columns render as the literal string "NULL" so the bash caller can distinguish them from empty strings.
Why a dedicated binary instead of psql: we don't want to require every developer / CI runner to have psql installed. We already depend on jackc/pgx (used by apps/orchestrator/state_store_postgres.go), so reusing it keeps the toolchain to "just go".