#!/usr/bin/env bats # Seam: scripts/homepage-status.py # Given a service config, the checker writes a valid status.json with the # correct state per service: an open port is up, a closed port is down, # a wip service is wip (not probed). The output carries generated_at. load helpers setup() { CHECKER="$REPO_ROOT/scripts/homepage-status.py" TMP="$(mktemp -d)" UP_PORT=18899 DOWN_PORT=18900 # Hold a TCP listener on UP_PORT so a probe of it succeeds. python3 -c 'import socket,time; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1); s.bind(("127.0.0.1",'"$UP_PORT"')); s.listen(5); time.sleep(300)' & LISTENER_PID=$! sleep 0.5 } teardown() { [ -n "${LISTENER_PID:-}" ] && kill "$LISTENER_PID" 2>/dev/null rm -rf "$TMP" } @test "checker: open port is up, closed port is down, wip is wip" { local svc="$TMP/services.json" out="$TMP/status.json" cat > "$svc" <