refactor: harden diagnostics and consolidate runtime code
This commit is contained in:
@@ -3,6 +3,7 @@ package app
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"bee/audit/internal/schema"
|
||||
@@ -145,6 +146,21 @@ func TestSATFailureDetailFallsBackToFailedSubJobs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSATFailureDetailIncludesValidatorDetail(t *testing.T) {
|
||||
runDir := t.TempDir()
|
||||
summary := "2-all-reduce-perf_rc=0\n" +
|
||||
"2-all-reduce-perf_status=FAILED\n" +
|
||||
"2-all-reduce-perf_detail=NVLink state does not match selected topology: GPU0<->GPU1\n" +
|
||||
"overall_status=FAILED\n"
|
||||
if err := os.WriteFile(filepath.Join(runDir, "summary.txt"), []byte(summary), 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got := SATFailureDetail(runDir)
|
||||
if !strings.Contains(got, "NVLink state does not match selected topology") {
|
||||
t.Fatalf("SATFailureDetail() = %q, want validator detail", got)
|
||||
}
|
||||
}
|
||||
|
||||
// TestSATFailureDetailEmptyWhenNoReasonFound guards the ultimate fallback:
|
||||
// when summary.txt carries no identifiable per-job or warnings detail (e.g.
|
||||
// unreadable or from an older binary version), callers must get "" so they
|
||||
@@ -233,6 +249,21 @@ func TestApplySATResultToDBNvidiaConfigSharesGPUKeyWithOtherNvidiaTargets(t *tes
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplySATResultToDBNvidiaInterconnectFailureReachesGPUComponent(t *testing.T) {
|
||||
db, err := OpenComponentStatusDB(filepath.Join(t.TempDir(), "component-status.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ApplySATResultToDB(db, "nvidia-interconnect", writeSATSummary(t, "FAILED"))
|
||||
rec, ok := db.Get("pcie:gpu:nvidia")
|
||||
if !ok {
|
||||
t.Fatal("nvidia-interconnect failure wrote no pcie:gpu:nvidia record")
|
||||
}
|
||||
if rec.Status != "Warning" {
|
||||
t.Fatalf("status=%q want Warning", rec.Status)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRecordDeduplicatesRepeatedIdenticalStatusFromSameSource guards the
|
||||
// hardware-ingest-contract.md rule that status_history is a transition log
|
||||
// ("История переходов статусов"), not a per-poll journal. A component
|
||||
|
||||
Reference in New Issue
Block a user