From 444b1f387a29f153e5b5af47380002b055dd5b33 Mon Sep 17 00:00:00 2001 From: Grayson Wolf Date: Wed, 24 Jun 2026 13:11:51 -0400 Subject: [PATCH] d/t/access-web-interface: make ready check more robust Test was failing (on Ubuntu) after an unrelated systemd update caused things to be reordered enough to cause the 30 second time limit to overrun, meaning apache wouldn't be ready and the test would fail. Reviewed-by: James Valleroy --- debian/tests/access-web-interface | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/debian/tests/access-web-interface b/debian/tests/access-web-interface index 34e70530a..60fa33fa6 100644 --- a/debian/tests/access-web-interface +++ b/debian/tests/access-web-interface @@ -2,8 +2,31 @@ set -e -# Wait for FreedomBox setup to complete. -sleep 30 +# Wait for FreedomBox first-boot setup to complete and the web server to +# start listening. App setup order is not deterministic, so a fixed sleep can +# expire before the apache app configures port 443. Poll instead of guessing. +echo "Waiting for first-boot setup to complete..." + +SETUP_COMPLETE=0 + +for _ in $(seq 1 120); do + if curl --fail --insecure --silent --output /tmp/fbx_status.json \ + https://localhost/freedombox/status/; then + + if grep -q '"is_first_setup_running"[[:space:]]*:[[:space:]]*false' /tmp/fbx_status.json; then + SETUP_COMPLETE=1 + break + fi + fi + sleep 2 +done + +rm -f /tmp/fbx_status.json + +if [ "$SETUP_COMPLETE" -eq 0 ]; then + echo "Error: first-boot setup did not complete in the allotted time." >&2 + exit 1 +fi journalctl --unit=plinth --unit=freedombox-privileged