57 lines
1.1 KiB
Go
57 lines
1.1 KiB
Go
package nvidia
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.mchus.pro/mchus/logpile/internal/models"
|
|
"git.mchus.pro/mchus/logpile/internal/parser"
|
|
)
|
|
|
|
func TestApplyGPUModelsFromSKU(t *testing.T) {
|
|
files := []parser.ExtractedFile{
|
|
{
|
|
Path: "inventory/fieldiag_summary.json",
|
|
Content: []byte(`{
|
|
"ModsRuns":[
|
|
{"ModsHeader":[
|
|
{"GpuName":"SXM5_SN_1653925025497","BoardInfo":"G520-0280"}
|
|
]}
|
|
]
|
|
}`),
|
|
},
|
|
{
|
|
Path: "testspec.json",
|
|
Content: []byte(`{
|
|
"actions":[
|
|
{
|
|
"virtual_id":"inventory",
|
|
"args":{
|
|
"sku_to_sku_json_file_map":{
|
|
"G520-0280":"sku_hgx-h200-8-gpu_141g_aircooled_field.json"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}`),
|
|
},
|
|
}
|
|
|
|
result := &models.AnalysisResult{
|
|
Hardware: &models.HardwareConfig{
|
|
GPUs: []models.GPU{
|
|
{
|
|
Slot: "GPUSXM5",
|
|
SerialNumber: "1653925025497",
|
|
Model: "NVIDIA Device 2335",
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
ApplyGPUModelsFromSKU(files, result)
|
|
|
|
if got := result.Hardware.GPUs[0].Model; got != "NVIDIA H200 SXM" {
|
|
t.Fatalf("expected model NVIDIA H200 SXM, got %q", got)
|
|
}
|
|
}
|