R-772: a health probe that could not run records not_checked + NOT healthy, is looked at again on the 10 s cycle, and the app page says so
The state stays the containers' (probeSaysUnhealthy skips a not-checked record), so R-630 holds. Red-proof RP-D1 — felhom.eu audits/visitors-2026-10-01/D. 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:
@@ -0,0 +1,41 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"html"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.dooplex.hu/admin/felhom-controller/internal/stacks"
|
||||
)
|
||||
|
||||
// R-772: the app page SAYS when the declared health check could not run, in the reader's language, and says nothing
|
||||
// when the check ran (or when there is no record). Both branches rendered — a line in a template that no test renders
|
||||
// is a seam built and never wired.
|
||||
func TestR772_AppPageSaysTheCheckDidNotRun(t *testing.T) {
|
||||
s := i18nTestServer(t)
|
||||
page := func(name string, hp *stacks.HealthProbeResult) i18nCase {
|
||||
return i18nCase{name, "app_info", func() map[string]interface{} {
|
||||
d := i18nLayoutData("stacks", "Karakeep")
|
||||
st := i18nStack("karakeep", "Karakeep", stacks.StateDegraded, true)
|
||||
st.HealthProbe = hp
|
||||
d["Stack"], d["Meta"], d["AppInfo"] = &st, st.Meta, st.Meta.AppInfo
|
||||
return d
|
||||
}}
|
||||
}
|
||||
notRun := page("r772_not_checked", &stacks.HealthProbeResult{NotChecked: true})
|
||||
ran := page("r772_checked", &stacks.HealthProbeResult{Healthy: true})
|
||||
none := page("r772_no_record", nil)
|
||||
enLine, huLine := "No health check ran: no matching container.", stacks.MsgHealthNoProbeContainer
|
||||
en := html.UnescapeString(renderI18nCase(t, s, "en", notRun))
|
||||
hu := html.UnescapeString(renderI18nCase(t, s, "hu", notRun))
|
||||
if !strings.Contains(en, enLine) || strings.Contains(en, huLine) || !strings.Contains(hu, huLine) {
|
||||
t.Fatalf("the not-checked line must reach the page in the reader's language")
|
||||
}
|
||||
for _, c := range []i18nCase{ran, none} {
|
||||
for _, lang := range []string{"en", "hu"} {
|
||||
if out := renderI18nCase(t, s, lang, c); strings.Contains(out, "data-health-not-checked") {
|
||||
t.Fatalf("%s/%s: the line must not show when the check ran or there is no record", c.name, lang)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user