health check: the last six producers carry their dashboard sentence (R-79 option A, D3)
Docker unreachable, protected container down, and the four storage-path entries now carry a bundle key beside their wire text; the wire text is unchanged byte for byte. Hungarian values of the four storage keys equal the frozen formats (i18n_go_parity). Red-proven: a zero MsgRef on the unavailable-path warning fails TestR79_RemainingProducersCarryTheirDashboardSentence and TestR79_HealthBannersFollowTheHousehold (producer-driven, English household sees Hungarian). 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,51 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.dooplex.hu/admin/felhom-controller/internal/config"
|
||||
"gitea.dooplex.hu/admin/felhom-controller/internal/monitor"
|
||||
"gitea.dooplex.hu/admin/felhom-controller/internal/settings"
|
||||
)
|
||||
|
||||
// R-79 option A (operator ruling D3, 2026-10-08) — the storage and protected-container entries of the
|
||||
// health check reached the banner verbatim: Hungarian for an English household (the frozen storage
|
||||
// formats), English for a Hungarian one (the container issue). Driven from the PRODUCER
|
||||
// (monitor.RunHealthCheck), not a hand-built report, so a dropped MsgRef in healthcheck.go is seen here.
|
||||
// Docker is refused under go test (R-650), so the Docker and protected-container issues appear on
|
||||
// every run of this test — that is the input, not a side effect on this host.
|
||||
//
|
||||
// COMPANION RED-PROOF: give the unavailable-path warning in checkStoragePaths a zero MsgRef — the "en"
|
||||
// case fails with „Adattároló nem elérhető: …".
|
||||
func TestR79_HealthBannersFollowTheHousehold(t *testing.T) {
|
||||
missing := filepath.Join(t.TempDir(), "gone")
|
||||
cfg := config.Default()
|
||||
cfg.Hub.Enabled = false
|
||||
cfg.Stacks.Protected = []string{"traefik"}
|
||||
hr := monitor.RunHealthCheck(cfg, nil, []settings.StoragePath{{Path: missing}}, settings.SMBSettings{}, nil)
|
||||
am := NewAlertManager(log.New(io.Discard, "", 0))
|
||||
am.Refresh(hr, cfg, nil, false, "")
|
||||
|
||||
want := map[string][]string{
|
||||
"hu": {"Adattároló nem elérhető: " + missing, "Egy védett rendszerszolgáltatás nem fut: traefik", "A Docker nem érhető el: "},
|
||||
"en": {"Storage not reachable: " + missing, "A protected system service is not running: traefik", "Docker is not reachable: "},
|
||||
}
|
||||
for lang, ws := range want {
|
||||
var got []string
|
||||
for _, a := range am.GetAlerts(lang) {
|
||||
if strings.HasPrefix(a.ID, "health-") {
|
||||
got = append(got, a.Message)
|
||||
}
|
||||
}
|
||||
joined := strings.Join(got, "\n")
|
||||
for _, w := range ws {
|
||||
if !strings.Contains(joined, w) {
|
||||
t.Errorf("%s: no banner contains %q; banners:\n%s", lang, w, joined)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user