feat(viewer): support hardware contract 2.10
This commit is contained in:
@@ -339,3 +339,81 @@ func TestRenderHTMLAddsSeverityFilterForEventLogs(t *testing.T) {
|
||||
t.Fatalf("expected synthetic severity icon column header to remain visually empty")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderHTMLDisplaysHardwareContract210Fields(t *testing.T) {
|
||||
snapshot := []byte(`{
|
||||
"filename": "redfish://10.10.10.103",
|
||||
"source_type": "api",
|
||||
"protocol": "redfish",
|
||||
"target_host": "10.10.10.103",
|
||||
"collected_at": "2026-02-10T15:30:00Z",
|
||||
"hardware": {
|
||||
"board": {
|
||||
"manufacturer": "Supermicro",
|
||||
"product_name": "X12DPG-QT6",
|
||||
"serial_number": "21D634101"
|
||||
},
|
||||
"storage": [
|
||||
{
|
||||
"slot": "OB01",
|
||||
"type": "NVMe",
|
||||
"model": "INTEL SSDPF2KX076T1",
|
||||
"size_gb": 7680,
|
||||
"logical_block_size_bytes": 512,
|
||||
"physical_block_size_bytes": 4096,
|
||||
"metadata_bytes_per_block": 8,
|
||||
"serial_number": "BTAX41900GF87P6DGN",
|
||||
"manufacturer": "Intel",
|
||||
"firmware": "9CV10510",
|
||||
"interface": "NVMe",
|
||||
"present": true,
|
||||
"status": "OK"
|
||||
}
|
||||
],
|
||||
"event_logs": [
|
||||
{
|
||||
"source": "redfish",
|
||||
"event_time": "2026-03-15T14:03:20Z",
|
||||
"severity": "Info",
|
||||
"message_id": "OpenBMC.0.1.SystemReboot",
|
||||
"message": "System reboot requested by administrator",
|
||||
"component_ref": "Mainboard"
|
||||
}
|
||||
],
|
||||
"platform_config": {
|
||||
"SecureBoot": "Enabled",
|
||||
"BiosVersion": "06.08.05",
|
||||
"TpmEnabled": true,
|
||||
"NumaEnabled": false,
|
||||
"HyperThreading": "Enabled"
|
||||
}
|
||||
}
|
||||
}`)
|
||||
|
||||
html, err := RenderHTML(snapshot, "Reanimator Chart")
|
||||
if err != nil {
|
||||
t.Fatalf("RenderHTML() error = %v", err)
|
||||
}
|
||||
|
||||
text := string(html)
|
||||
for _, needle := range []string{
|
||||
"Storage",
|
||||
"Event Logs",
|
||||
"Platform Config",
|
||||
"<th>logical_block_size_bytes</th>",
|
||||
"<th>physical_block_size_bytes</th>",
|
||||
"<th>metadata_bytes_per_block</th>",
|
||||
"512",
|
||||
"4096",
|
||||
"8",
|
||||
"SecureBoot",
|
||||
"Enabled",
|
||||
"TpmEnabled",
|
||||
"true",
|
||||
"System reboot requested by administrator",
|
||||
} {
|
||||
if !strings.Contains(text, needle) {
|
||||
t.Fatalf("expected rendered html to contain %q", needle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user