Reanimator contract v2.13 makes event_logs[].event_time optional
(Reanimator falls back to collection/ingest time) and defines is_active
("still active / not cleared").
- Omit event_time when the event has no source time instead of passing
collected_at off as the event time.
- is_active=true only from an authoritative active-alarm snapshot: Inspur
dev_status.log (IDL event ID / SEL sensor at the same instant) and
component.log fan state (new models.Event.Active). false for Deasserts,
superseded Asserts in a real Assert/Deassert lifecycle and Inspur
Warning/Critical Asserts missing from dev_status.log; unset otherwise.
A missing Deassert is not treated as active: AC loss and BMC resets drop
them (24C319575: PSU1 predictive failure).
- component.log fan events use source BMC instead of host.
- Request installed_at in the Reanimator contract to date component
installs from maintenance.log; follow-up in BACKLOG [installed_at].
ADL-072.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.5 KiB
Go
39 lines
1.5 KiB
Go
package inspur
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"git.mchus.pro/mchus/logpile/internal/models"
|
|
)
|
|
|
|
func TestApplyActiveFromDeviceStatus(t *testing.T) {
|
|
loc := time.FixedZone("+08", 8*3600)
|
|
mapout := time.Date(2026, 8, 12, 19, 23, 50, 0, loc)
|
|
psu := time.Date(2026, 8, 11, 19, 8, 50, 0, loc)
|
|
events := []models.Event{
|
|
{Timestamp: mapout, Source: "BMC", SensorName: "CPU0_C2D1", ID: "0C090401", EventType: "Assert", Severity: models.SeverityWarning},
|
|
{Timestamp: mapout, Source: "SEL", SensorName: "CPU0_C2D1", ID: "69", EventType: "Memory Device Disabled", RawData: "Asserted", Severity: models.SeverityWarning},
|
|
{Timestamp: psu, Source: "BMC", SensorName: "PSU1", ID: "08010201", EventType: "Assert", Severity: models.SeverityWarning},
|
|
{Timestamp: psu, Source: "BMC", SensorName: "PSU1", ID: "08010000", EventType: "Assert", Severity: models.SeverityInfo},
|
|
}
|
|
current := []models.Event{
|
|
{Timestamp: mapout, Source: "BMC", SensorName: "CPU0_C2D1", ID: "0C090401", EventType: "Assert", Severity: models.SeverityWarning},
|
|
}
|
|
|
|
applyActiveFromDeviceStatus(events, current)
|
|
|
|
if events[0].Active == nil || !*events[0].Active {
|
|
t.Fatalf("IDL alarm listed in dev_status must be active")
|
|
}
|
|
if events[1].Active == nil || !*events[1].Active {
|
|
t.Fatalf("SEL record of the same alarm must be active")
|
|
}
|
|
if events[2].Active == nil || *events[2].Active {
|
|
t.Fatalf("alarm missing from dev_status must be inactive even without Deassert")
|
|
}
|
|
if events[3].Active != nil {
|
|
t.Fatalf("info notification must stay unmarked")
|
|
}
|
|
}
|