fix(e2e): run binary service tests with sudo -E pv#68
Conversation
Previous E2E phases (start-curl, verify-final) use `sudo -E pv start`, which causes `cleanSitesDirs()` to recreate `~/.pv/config/sites/` as root-owned (0755). When s3-binary.sh and mail-binary.sh then ran `pv start` without sudo, the non-root daemon called `os.RemoveAll` on the root-owned sites dir — which failed (no write permission inside it) — causing `GenerateAllConfigs` to abort, `Start()` to exit, and the PID file to be cleaned up. `server.IsRunning()` then returned false, `service:add s3/mail` printed "daemon not running", and the stale daemon-status.json from Phase 19 (empty supervised) was what the test inspected. Fix: use `sudo -E pv` for all daemon and service commands in both binary-service scripts, consistent with every other E2E phase that needs a live daemon. Also increase the post-start sleep from 3 s to 8 s to match the pattern used in start-curl.sh / verify-final.sh (FrankenPHP can take up to 5 s to pass its health check). Co-authored-by: Clovis <munezaclovis@users.noreply.github.com>
|
@claude CI still failing. plz check |
|
Claude finished @munezaclovis's task in 4m 17s —— View job CI Fix Pushed
Root Cause
Fix (commit
|
SignalDaemon() sends SIGHUP asynchronously — the daemon's reconcile loop (which writes daemon-status.json with supervised entries) runs concurrently with service:add returning. Checking the file immediately races against the reconcile. Add a 20-iteration/1s retry loop matching the pattern used for port-reachability checks in both binary-service scripts. Co-authored-by: Clovis <munezaclovis@users.noreply.github.com>
|
@claude progress! we have a new error |
|
Claude finished @munezaclovis's task in 3m 59s —— View job Fix Pushed
Root Cause
FixAdded # Disable daemon if auto-enabled during install — e2e tests use foreground mode with sudo.
pv daemon:disable 2>/dev/null || true
+# pv install starts the daemon immediately; stop it so the PID file is gone before we start fresh.
+sudo -E pv stop >/dev/null 2>&1 || true
sleep 1
sudo -E pv start &| Branch |
pv install auto-starts the daemon; daemon:disable unregisters the launchd service but the process stays alive until FrankenPHP and DNS finish shutting down. The subsequent sudo pv start saw a live PID and failed. Add an explicit pv stop (waits up to 5 s with SIGTERM/SIGKILL) between daemon:disable and the foreground start. Co-authored-by: Clovis <munezaclovis@users.noreply.github.com>
|
@claude Next: |
|
Claude finished @munezaclovis's task in 1m 4s —— View job Fix Pushed
Root Cause
The cleanup trap already correctly used Fix-pv link "$ENVTEST_DIR" --name e2e-mail-env >/dev/null 2>&1 || { echo "FAIL: pv link for env test"; exit 1; }
+sudo -E pv link "$ENVTEST_DIR" --name e2e-mail-env >/dev/null 2>&1 || { echo "FAIL: pv link for env test"; exit 1; }| Branch |
Root-owned config dirs (created by sudo -E pv start) block the non-root pv link call. Consistent with the sudo -E pv unlink already in cleanup. Co-authored-by: Clovis <munezaclovis@users.noreply.github.com>
Fixes #67
Previous E2E phases use
sudo -E pv start, which causescleanSitesDirs()to recreate~/.pv/config/sites/as root-owned (0755). Whens3-binary.shandmail-binary.shthen ranpv startwithout sudo, the non-root daemon calledos.RemoveAllon the root-owned sites dir — which failed with permission denied — causingGenerateAllConfigsto abort,Start()to exit, and the PID file to be cleaned up.server.IsRunning()then returned false,service:add s3/mailprinted "daemon not running", and the stale daemon-status.json from Phase 19 (emptysupervised) was what the test inspected.Use
sudo -E pvfor all daemon and service commands in both binary-service scripts, consistent with every other E2E phase that needs a live daemon. Also increase the post-start sleep from 3 s to 8 s to match the pattern used in start-curl.sh / verify-final.sh.Generated with Claude Code