Files
felhom.eu/hub/internal/notify/os_alarms_operator_test.go
T

28 lines
1.2 KiB
Go

package notify
import (
"testing"
"gitea.dooplex.hu/admin/felhom-hub/internal/osupdates"
)
// Every OS-update event except the household's own line is operator-only (`11` §5.7, §8.3). An operator alarm left
// off this list reaches the customer as raw operator English. Red-proof: delete one alarm line from
// operatorOnlyEvents and this fails naming it.
func TestOSUpdateEvents_OperatorOnlyExceptApplied(t *testing.T) {
for _, e := range []string{osupdates.EventFailed, osupdates.EventHealthFailed, osupdates.EventReleaseApprove,
osupdates.EventApprovedNow, osupdates.EventSettings, osupdates.EventStale, osupdates.EventRebootNeeded,
osupdates.EventRing0Stalled, osupdates.EventNotCovered, "tunnel_down", "tunnel_recovered",
"host_crash_restart", "host_crash_guard_tripped", "host_crash_guard_rearmed", "host_kernel_oops"} {
if !operatorOnlyEvents[e] {
t.Errorf("%s is not operator-only", e)
}
}
if operatorOnlyEvents["host_restarted_after_crash"] {
t.Errorf("host_restarted_after_crash is the household's line and must NOT be operator-only")
}
if operatorOnlyEvents[osupdates.EventApplied] {
t.Errorf("%s is the household's line and must NOT be operator-only", osupdates.EventApplied)
}
}