hub v0.73.1: allowlist disk_health_degraded (controller v0.169.0 disk-health)
Adds disk_health_degraded to allowedEventTypes so the controller's per-disk SMART degradation notification is ingested, not 400-rejected. Deliberately no customerMessages entry (like offbox_enlarge_blocked) — the controller's dynamic Hungarian message (disk label + attributes) is preserved by the templates.go fallback. Test + red-proof.
This commit is contained in:
@@ -97,6 +97,25 @@ func TestHandleEvent_OffboxEnlargeBlockedAccepted(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Scenario (controller v0.169.0): disk_health_degraded is an accepted controller-pushed type — the
|
||||
// disk-health degradation email's delivery chain starts at hub ingestion. Red-proof: removing the
|
||||
// allowlist entry makes this 400 (which would silently drop the customer's disk-degradation email).
|
||||
func TestHandleEvent_DiskHealthDegradedAccepted(t *testing.T) {
|
||||
h, st := newEventTestHandler(t)
|
||||
|
||||
rr := do(h, http.MethodPost, "/event", "ckey", eventBody("warning", "disk_health_degraded"))
|
||||
if rr.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, want 200 (disk_health_degraded must be allowlisted); body=%s", rr.Code, rr.Body.String())
|
||||
}
|
||||
evs, err := st.GetRecentEvents("c1", 10)
|
||||
if err != nil {
|
||||
t.Fatalf("GetRecentEvents: %v", err)
|
||||
}
|
||||
if len(evs) != 1 || evs[0].EventType != "disk_health_degraded" {
|
||||
t.Errorf("stored = %+v, want exactly one disk_health_degraded event", evs)
|
||||
}
|
||||
}
|
||||
|
||||
// Auth: no bearer at all is a 401 and stores nothing.
|
||||
func TestHandleEvent_Unauthorized(t *testing.T) {
|
||||
h, st := newEventTestHandler(t)
|
||||
|
||||
@@ -1572,6 +1572,11 @@ var allowedEventTypes = map[string]bool{
|
||||
"storage_reconnected": true,
|
||||
"disk_warning": true,
|
||||
"disk_critical": true,
|
||||
// controller v0.169.0 — per-disk SMART degradation (Rendben→Figyelmeztetés/Hiba). The controller
|
||||
// sends a dynamic Hungarian message (disk label + the triggering attribute names), so — like
|
||||
// offbox_enlarge_blocked — there is deliberately NO customerMessages entry (which would discard the
|
||||
// specifics via the templates.go fallback priority).
|
||||
"disk_health_degraded": true,
|
||||
"health_degraded": true,
|
||||
"health_critical": true,
|
||||
"health_recovered": true,
|
||||
|
||||
Reference in New Issue
Block a user