Files
felhom.eu/hub/internal/notify/kernel_notice_test.go
T
admin ab3b7ea2f4
gates / gates (push) Successful in 2m47s
hub v0.143.0 (code): the kernel lane — the day-before household mail, the night instruction, the operator's kernel set (R-836, decision 172)
KernelDue / KernelNotify (09-20 h Budapest, one per 20 h, max 3, registered
address, only an accepted mail counts) / os_update.kernel {kver, tonight}
(no mail, no step) / layer kernel ingest + operator events / Approve kernel
set after every ring-0 box booted it healthily after a night stage / two
System page cells. 11 §5.11 written; §5.10 status corrected (proven).
Installer uninstall knows the two GRUB generators (unreleased).
Evidence: audits/kernel-lane-2026-10-07/ (red-proofs, boot timing).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-10-07 15:34:14 +02:00

34 lines
1.3 KiB
Go

package notify
import (
"strings"
"testing"
)
// R-836, `09` §3 decision 172: the household's day-before mail — both languages, informal, says the box restarts
// tonight and exactly what to do if it is not back by morning. ASCII fragments with a positive and a negative control
// (rule 8: an accented search can return nothing for text that is there).
func TestKernelNotice_SaysWhatToDo(t *testing.T) {
for lang, want := range map[string][]string{
"hu": {"jjel", "jraindul", "tápkábel"[:2], "10 m", "dugd", "vissza", "korábbi"[:3]},
"en": {"Tonight", "restarts", "unplug", "10 seconds", "plug it back", "earlier, proven"},
} {
subj, body := FormatKernelNoticeEmail(lang)
if subj == "" || body == "" || strings.HasPrefix(subj, "mail.") || strings.HasPrefix(body, "mail.") {
t.Fatalf("%s: missing text: %q / %q", lang, subj, body)
}
for _, w := range want {
if !strings.Contains(body, w) {
t.Fatalf("%s: body lacks %q:\n%s", lang, w, body)
}
}
if strings.Contains(body, "7.0.") || strings.Contains(body, "%") {
t.Fatalf("%s: the household needs what to do, not a kernel version or a format verb:\n%s", lang, body)
}
}
// negative control: a key that does not exist comes back as its own name
if s, _ := FormatClaimEmail("en", "claim", "c", "d", "x"); strings.Contains(s, "unplug") {
t.Fatal("negative control matched")
}
}