Fix NIC port count handling and apply pending exporter updates

This commit is contained in:
2026-02-28 18:42:01 +03:00
parent 612058ed16
commit fe5da1dbd7
7 changed files with 362 additions and 4 deletions
+34
View File
@@ -551,6 +551,40 @@ func TestEnrichNICFromPCIeFunctions(t *testing.T) {
}
}
func TestParseNIC_PortCountFromControllerCapabilities(t *testing.T) {
nic := parseNIC(map[string]interface{}{
"Id": "1",
"Controllers": []interface{}{
map[string]interface{}{
"ControllerCapabilities": map[string]interface{}{
"NetworkPortCount": 2,
},
},
},
})
if nic.PortCount != 2 {
t.Fatalf("expected port_count=2, got %d", nic.PortCount)
}
}
func TestParseNIC_DropsUnrealisticPortCount(t *testing.T) {
nic := parseNIC(map[string]interface{}{
"Id": "1",
"Controllers": []interface{}{
map[string]interface{}{
"ControllerCapabilities": map[string]interface{}{
"NetworkPortCount": 825307750,
},
},
},
})
if nic.PortCount != 0 {
t.Fatalf("expected unrealistic port count to be dropped, got %d", nic.PortCount)
}
}
func TestParsePCIeDevice_PrefersFunctionClassOverDeviceType(t *testing.T) {
doc := map[string]interface{}{
"Id": "NIC1",