Files
felhom-controller/controller/cmd/controller/r1347_r1348_wiring_test.go
T

42 lines
1.5 KiB
Go

package main
import (
"testing"
"gitea.dooplex.hu/admin/felhom-controller/internal/settings"
)
// R-1347 and R-1348: each seam is CALLED from main.go (an AST walk) — a seam built and never wired is the project's
// oldest shape.
func TestR1347_UpdateHeldForgetterIsWiredAtStartup(t *testing.T) {
lines, _, _ := slice4CallLines(t)
if len(lines["SetUpdateHeldForgetter"]) == 0 {
t.Fatal("main.go never calls SetUpdateHeldForgetter — a restored app would stay unwatched until the controller restarts")
}
}
func TestR1348_HeldNotifyIsWiredAtStartup(t *testing.T) {
lines, _, _ := slice4CallLines(t)
if len(lines["SetHeldNotify"]) == 0 {
t.Fatal("main.go never calls SetHeldNotify — a failed put-back at start-up would mail nobody")
}
}
// The mail's run name for an interrupted put-back. RED (2026-11-03, live on 9202): the sink showed run_kind offsite-reconstitute for a
// local restore.
func TestR1348_HeldRunKind(t *testing.T) {
for _, c := range []struct {
h settings.RestoreHold
want string
}{
{settings.RestoreHold{Reason: settings.HoldReasonRestoreMixed, MixedCause: settings.MixedCauseInterruptedPutBack}, "restore"},
{settings.RestoreHold{RestoreKind: settings.RestoreKindLocal}, "restore"},
{settings.RestoreHold{RestoreKind: settings.RestoreKindOffsite}, "offsite-reconstitute"},
{settings.RestoreHold{Reason: settings.HoldReasonRestoreMixed}, "offsite-reconstitute"},
} {
if got := heldRunKind(c.h); got != c.want {
t.Errorf("%+v: run kind %q, want %q", c.h, got, c.want)
}
}
}