HPE DL380 Gen11 BEE-SP v14.23 blackbox bundle (ADL-077): - topology: accept "PROC n" DIMM locators, show the storage controller filtered from the export by ADL-062 when disks resolve to it, resolve storcli EID:Slt drives via VD -> OS drive -> controller BDF, hide BMC VGA, label numeric PSU slots "PSU n" - easy_bee: parse SEL / dmesg -T event times, keep message_id and component_ref, pass platform_config through - exporter: map ipmi-sel -> bmc and dmesg/kernel -> host in event_logs - privacy: treat journald/syslog kernel lines as noise (linux.it false positive) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.8 KiB
Go
62 lines
2.8 KiB
Go
package exporter
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"git.mchus.pro/mchus/logpile/internal/models"
|
|
)
|
|
|
|
func TestConvertEventLogs_UndatedEventHasNoEventTime(t *testing.T) {
|
|
logs := convertEventLogs([]models.Event{{Source: "BMC", Description: "FAN3 reports Critical"}})
|
|
if len(logs) != 1 {
|
|
t.Fatalf("expected 1 log, got %d", len(logs))
|
|
}
|
|
if logs[0].EventTime != "" {
|
|
t.Fatalf("event without source time must not get collection time, got %q", logs[0].EventTime)
|
|
}
|
|
}
|
|
|
|
func TestConvertEventLogs_IsActive(t *testing.T) {
|
|
t0 := time.Date(2026, 8, 12, 10, 0, 0, 0, time.UTC)
|
|
yes := true
|
|
events := []models.Event{
|
|
// 0..2: condition with lifecycle, latest Assert still open.
|
|
{Timestamp: t0, Source: "BMC", SensorType: "memory", SensorName: "CPU0_C2D1", ID: "0C090401", EventType: "Assert", Description: "disabled"},
|
|
{Timestamp: t0.Add(time.Minute), Source: "BMC", SensorType: "memory", SensorName: "CPU0_C2D1", ID: "0C090401", EventType: "Deassert", Description: "disabled"},
|
|
{Timestamp: t0.Add(2 * time.Minute), Source: "BMC", SensorType: "memory", SensorName: "CPU0_C2D1", ID: "0C090401", EventType: "Assert", Description: "disabled"},
|
|
// 3: one-shot Assert without lifecycle.
|
|
{Timestamp: t0, Source: "BMC", SensorType: "sys restart", SensorName: "SYS RESTART", ID: "1D020000", EventType: "Assert", Description: "restart"},
|
|
// 4: explicit snapshot state.
|
|
{Source: "BMC", SensorType: "fan", SensorName: "FAN3", EventType: "Fan Status", Description: "FAN3 reports Critical", Active: &yes},
|
|
// 5: SEL-style record: condition in EventType, phase in RawData.
|
|
{Timestamp: t0, Source: "SEL", SensorType: "power supply", SensorName: "PSU0_Status", ID: "10", EventType: "Predictive failure", RawData: "Asserted", Description: "Predictive failure"},
|
|
{Timestamp: t0.Add(time.Minute), Source: "SEL", SensorType: "power supply", SensorName: "PSU0_Status", ID: "15", EventType: "Predictive failure", RawData: "Deasserted", Description: "Predictive failure"},
|
|
}
|
|
|
|
logs := convertEventLogs(events)
|
|
want := []*bool{ptrBool(false), ptrBool(false), nil, nil, ptrBool(true), ptrBool(false), ptrBool(false)}
|
|
for i, w := range want {
|
|
got := logs[i].IsActive
|
|
switch {
|
|
case w == nil && got != nil:
|
|
t.Fatalf("log %d: expected is_active unset, got %v", i, *got)
|
|
case w != nil && (got == nil || *got != *w):
|
|
t.Fatalf("log %d: expected is_active=%v, got %v", i, *w, got)
|
|
}
|
|
}
|
|
}
|
|
|
|
func ptrBool(v bool) *bool { return &v }
|
|
|
|
func TestConvertEventLogs_EasyBeeSources(t *testing.T) {
|
|
logs := convertEventLogs([]models.Event{
|
|
{Source: "ipmi-sel", Description: "Transition to Non-critical from OK"},
|
|
{Source: "dmesg", Description: "usb 1-1: device not accepting address 3, error -71"},
|
|
{Source: "Bee Runtime", Description: "Bee runtime status: PARTIAL"},
|
|
})
|
|
if len(logs) != 2 || logs[0].Source != "bmc" || logs[1].Source != "host" {
|
|
t.Fatalf("unexpected event_logs: %+v", logs)
|
|
}
|
|
}
|