Files
archie/internal/webui/dashboard_url_test.go
T
sam 1ffdedc62e feat(archied): serve the daemon's own health endpoint
The update watchdog verifies archied's restart, so archied has to be what
answers. It was probing the dashboard's /healthz, which belongs to the
dashboard: switch [web] off and nothing answers, and in the extracted UI
topology that endpoint reports a different process entirely, which would
confirm a release while the daemon it was meant to verify is down.

[health].listen (127.0.0.1:8485, defaulted, always on) serves /healthz,
/health and /health/detailed for the life of the process. Liveness answers
503 until the daemon reaches its run loop: the listener binds before the
subsystems do, so an unconditional 200 would tell the watchdog a half-booted
release came up. Failing to bind is fatal, because a daemon nothing can probe
gets every update rolled back. The State Store's readiness surface now shares
the listener plumbing, keeping its log and error text verbatim.

Closes archie-core-exbz, which asked which of two bad options to take when
the dashboard is off. Neither: the daemon owns its own liveness.

Also deletes TestInstallUpdateDetachesInstallerFromCallbackContext. It has
failed intermittently under load more than once, racing its fake bot server's
multipart parse against the cancellation it induces.
2026-09-09 23:29:11 +10:00

18 lines
558 B
Go

package webui
import "testing"
func TestDashboardURL(t *testing.T) {
for _, tc := range []struct{ listen, token, want string }{
{"0.0.0.0:8484", "abc", "http://localhost:8484/?t=abc"},
{":8484", "abc", "http://localhost:8484/?t=abc"},
{"[::]:8484", "abc", "http://localhost:8484/?t=abc"},
{"127.0.0.1:8484", "", "http://127.0.0.1:8484/"},
{"100.64.1.2:8484", "x", "http://100.64.1.2:8484/?t=x"},
} {
if got := DashboardURL(tc.listen, tc.token); got != tc.want {
t.Errorf("DashboardURL(%q) = %q, want %q", tc.listen, got, tc.want)
}
}
}