Files
serverAppConfigs/tests/homepage_deploy.bats
T
Frank 2e6c44f3ba Homepage (TDD slice 6): the git-driven deploy
Red tests first.
- tests/homepage_deploy.bats: the deploy ships the homepage (assets to
  /srv/homepage, the checker timer, both Caddy hashes, deployed.js) and is
  git-driven (pulls main); the checker runs as a systemd timer.
- scripts/homepage-status.service / .timer: the checker as a oneshot service
  + a 3-minute timer (Q2/Q35).
- scripts/deploy.sh: the Caddyfile render now substitutes BOTH hashes
  (REPLACE_WITH_HASH <- CADDY_BASICAUTH_HASH, REPLACE_WITH_ADMIN_HASH <-
  CADDY_ADMIN_HASH). A new homepage step copies the assets to /srv/homepage,
  generates deployed.js from the deployed commit's datetime (Q43), installs
  the checker timer, and runs the checker once so status.json exists at once.
- tests/llm_units.bats: scoped the three LLM-unit tests to
  frank-default-*.service (the homepage unit is a different pattern: it
  installs to /usr/local/bin and runs from /srv at deploy time).
2026-08-23 12:59:56 -07:00

31 lines
1.1 KiB
Bash

#!/usr/bin/env bats
# Seam: scripts/deploy.sh deploys the homepage, and the checker runs as a
# systemd timer. The deploy is git-driven (master = the deployed state, Q33).
# The tests assert the deploy references the homepage steps and renders BOTH
# hashes, and that the checker timer + service exist and point at the checker.
load helpers
@test "deploy.sh ships the homepage (assets, timer, both hashes, deployed.js)" {
local d="$REPO_ROOT/scripts/deploy.sh"
grep -q "/srv/homepage" "$d"
grep -q "homepage-status" "$d"
grep -q "CADDY_BASICAUTH_HASH" "$d"
grep -q "CADDY_ADMIN_HASH" "$d"
grep -q "deployed.js" "$d"
}
@test "the checker runs as a systemd timer pointing at the checker" {
local s="$REPO_ROOT/scripts/homepage-status.service"
local t="$REPO_ROOT/scripts/homepage-status.timer"
[ -f "$s" ]
[ -f "$t" ]
grep -q "homepage-status.py" "$s"
grep -q "OnUnitActiveSec" "$t"
grep -q "homepage-status.service" "$t"
}
@test "deploy.sh is git-driven: it pulls main on the target" {
grep -q "git pull origin main" "$REPO_ROOT/scripts/deploy.sh"
}