fix(easy_bee): fall back to bundled NVIDIA bug report without bee-audit.json
BEE-SP v14.08 bundles from Dell R7715 were captured while bee-audit.service was still running (stuck in ipmitool sensor), so bee-audit.json was missing and import failed with "easy-bee snapshot not found". Rebuild board, CPU, DIMM, GPU and NIC inventory from export/gpu/nvidia-bug-report.txt, add an Incomplete Audit warning, and name the audit service state in the error when no fallback source exists. ADL-076. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
29371f69ee
commit
9f5f7a98be
5 files changed
+236
-3
No files matched your search
+110
@@ -0,0 +1,110 @@
|
||||
package easy_bee
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.mchus.pro/mchus/logpile/internal/models"
|
||||
"git.mchus.pro/mchus/logpile/internal/parser"
|
||||
)
|
||||
|
||||
const incompleteAuditPrefix = "bee-support-stage-easy-bee-nvidia-v14-08-20260917-211720"
|
||||
|
||||
func incompleteAuditFiles(withReport bool) []parser.ExtractedFile {
|
||||
files := []parser.ExtractedFile{
|
||||
{
|
||||
Path: incompleteAuditPrefix + "/manifest.txt",
|
||||
Content: []byte("bee_version=14.08\nhost=easy-bee-nvidia-v14-08\ngenerated_at_utc=2026-09-17T21:17:37Z\nexport_dir=/appdata/bee/export\n"),
|
||||
},
|
||||
{
|
||||
Path: incompleteAuditPrefix + "/status/runtime-health.json",
|
||||
Content: []byte(`{"status":"OK"}`),
|
||||
},
|
||||
{
|
||||
Path: incompleteAuditPrefix + "/tasks/_services/bee-audit.service.status.txt",
|
||||
Content: []byte("● bee-audit.service - Bee: hardware audit\n" +
|
||||
" Loaded: loaded (/etc/systemd/system/bee-audit.service; enabled; preset: enabled)\n" +
|
||||
" Active: activating (start) since Thu 2026-09-17 21:14:58 UTC; 2min 22s ago\n"),
|
||||
},
|
||||
}
|
||||
if withReport {
|
||||
files = append(files, parser.ExtractedFile{
|
||||
Path: incompleteAuditPrefix + "/export/gpu/nvidia-bug-report.txt",
|
||||
Content: []byte(`NVIDIA bug report log file
|
||||
nvidia-bug-report.sh Version: 1
|
||||
Date: Thu Sep 17 21:17:21 UTC 2026
|
||||
System Information
|
||||
Manufacturer: Dell Inc.
|
||||
Product Name: PowerEdge R7715
|
||||
Serial Number: 3VVFYL4
|
||||
|
||||
Processor Information
|
||||
Version: AMD EPYC 9255 24-Core Processor
|
||||
Core Count: 24
|
||||
Thread Count: 48
|
||||
Status: Populated, Enabled
|
||||
|
||||
Memory Device
|
||||
Size: 32 GB
|
||||
Locator: A1
|
||||
Type: DDR5
|
||||
Manufacturer: Samsung
|
||||
Serial Number: 01C12D98
|
||||
Part Number: M321R4GA3EB2-CCPKF
|
||||
`),
|
||||
})
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
// Bundles captured while bee-audit.service was still running have no
|
||||
// bee-audit.json; inventory is rebuilt from the bundled NVIDIA bug report.
|
||||
func TestParseFallsBackToNvidiaBugReportWhenAuditIncomplete(t *testing.T) {
|
||||
p := &Parser{}
|
||||
files := incompleteAuditFiles(true)
|
||||
if got := p.Detect(files); got < 50 {
|
||||
t.Fatalf("expected easy-bee detection without snapshot, got %d", got)
|
||||
}
|
||||
|
||||
result, err := p.Parse(files)
|
||||
if err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
if result.Hardware.BoardInfo.SerialNumber != "3VVFYL4" || result.Hardware.BoardInfo.ProductName != "PowerEdge R7715" {
|
||||
t.Fatalf("unexpected board: %+v", result.Hardware.BoardInfo)
|
||||
}
|
||||
if len(result.Hardware.CPUs) != 1 || len(result.Hardware.Memory) != 1 {
|
||||
t.Fatalf("expected 1 CPU and 1 DIMM, got %d/%d", len(result.Hardware.CPUs), len(result.Hardware.Memory))
|
||||
}
|
||||
if result.TargetHost != "easy-bee-nvidia-v14-08" {
|
||||
t.Fatalf("unexpected target host %q", result.TargetHost)
|
||||
}
|
||||
if got := result.CollectedAt.Format("2006-01-02T15:04:05Z"); got != "2026-09-17T21:17:21Z" {
|
||||
t.Fatalf("unexpected collected_at %s", got)
|
||||
}
|
||||
|
||||
var notice *models.Event
|
||||
for i := range result.Events {
|
||||
if result.Events[i].EventType == "Incomplete Audit" {
|
||||
notice = &result.Events[i]
|
||||
}
|
||||
}
|
||||
if notice == nil {
|
||||
t.Fatalf("expected incomplete audit event, got %+v", result.Events)
|
||||
}
|
||||
if !notice.Timestamp.IsZero() || notice.Severity != models.SeverityWarning ||
|
||||
!strings.Contains(notice.Description, "had not finished") {
|
||||
t.Fatalf("unexpected incomplete audit event: %+v", notice)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseWithoutSnapshotOrFallbackExplainsAuditState(t *testing.T) {
|
||||
_, err := (&Parser{}).Parse(incompleteAuditFiles(false))
|
||||
if err == nil {
|
||||
t.Fatal("expected error")
|
||||
}
|
||||
if msg := err.Error(); !strings.Contains(msg, "bee-audit.service had not finished") ||
|
||||
!strings.Contains(msg, "activating (start)") {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user