Fix NIC port count handling and apply pending exporter updates
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user