package app import ( "testing" "bee/audit/internal/schema" ) // TestFormatGPULineIgnoresNonGPUSameVendorDevice guards the bug where // isGPUDevice treated any NVIDIA-vendor PCIe device as a GPU regardless of // class (a fallback for "NVIDIA devices sometimes expose class values // outside the standard GPU set"). That fallback misclassified same-vendor // companion devices — e.g. NVSwitch/NVLink bridges, or an NVIDIA-branded NIC // — as compute GPUs, inflating the "GPU: N x " audit summary line. func TestFormatGPULineIgnoresNonGPUSameVendorDevice(t *testing.T) { vendor := 0x10de // collector.NvidiaVendorID bridgeClass := "Bridge" bridgeModel := "NVSwitch" gpuClass := "VideoController" gpuModel := "H100" devices := []schema.HardwarePCIeDevice{ {DeviceClass: &bridgeClass, VendorID: &vendor, Model: &bridgeModel}, {DeviceClass: &gpuClass, VendorID: &vendor, Model: &gpuModel}, } got := formatGPULine(devices) want := "GPU: 1 x H100" if got != want { t.Fatalf("formatGPULine() = %q, want %q", got, want) } }