v0.292.0: cloudflared readiness health check (R-841) — tunnel --metrics localhost:20241 run + Docker healthcheck on cloudflared's own /ready; the host agent reports running/not_running/unknown from State.Health
gates / gates (push) Successful in 28s
gates / gates (push) Successful in 28s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -282,3 +282,23 @@ func TestReconcileFileBrowserImage_MovesOnlyTheImage(t *testing.T) {
|
||||
t.Fatalf("an up-to-date file browser was touched: err %v calls %+v", err, *calls)
|
||||
}
|
||||
}
|
||||
|
||||
// R-841: the cloudflared compose carries a health check that asks cloudflared whether the tunnel is CONNECTED, and
|
||||
// pins the metrics address it asks. Red-proof: drop the healthcheck block from the template and this fails.
|
||||
func TestRenderCloudflared_HasAReadinessHealthcheck(t *testing.T) {
|
||||
for _, tunnel := range []bool{false, true} {
|
||||
f, err := infra.RenderCloudflared(infra.CloudflaredData{CFTunnelToken: "tok", Tunnel: tunnel})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
c := f["docker-compose.yml"].Content
|
||||
for _, want := range []string{
|
||||
"command: tunnel --metrics localhost:20241 run",
|
||||
`test: ["CMD", "cloudflared", "tunnel", "--metrics", "localhost:20241", "ready"]`,
|
||||
} {
|
||||
if !strings.Contains(c, want) {
|
||||
t.Fatalf("tunnel=%v: compose lacks %q:\n%s", tunnel, want, c)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user