package agentapi import "testing" // R-333 (`09` §3 decision 206): no heat band for an NVMe drive. Both directions, because "fixed" means // one kind of drive stopped alarming on heat and the other did not, and the drive's own alarm stays. func TestDiskVerdict_NVMeHasNoHeatBand(t *testing.T) { noPrior := DiskPrior{} cases := []struct { name string in *SmartSummary want DiskVerdict }{ // A healthy NVMe under load: 72 °C, the device raises no flag. No heat alarm. {"hot NVMe, no critical warning → ok", &SmartSummary{Health: SmartPassed, TemperatureC: ip(72), CriticalWarning: ip(0), PercentageUsed: ip(3), MediaErrors: ip(0)}, DiskVerdictOK}, {"warm NVMe 56 °C, no critical warning → ok", &SmartSummary{Health: SmartPassed, TemperatureC: ip(56), CriticalWarning: ip(0)}, DiskVerdictOK}, // The same drive with its own temperature bit set (critical_warning bit 1 = 0x02): Hiba. {"hot NVMe with critical_warning temperature bit → fail", &SmartSummary{Health: SmartPassed, TemperatureC: ip(72), CriticalWarning: ip(2)}, DiskVerdictFail}, {"cool NVMe with critical_warning → fail", &SmartSummary{Health: SmartPassed, TemperatureC: ip(40), CriticalWarning: ip(1)}, DiskVerdictFail}, // Spinning/SATA drives keep their 55/60 °C bands, unchanged. {"SATA 56 °C → warn", &SmartSummary{Health: SmartPassed, TemperatureC: ip(56), ReallocatedSectors: ip(0)}, DiskVerdictWarn}, {"SATA 60 °C → fail", &SmartSummary{Health: SmartPassed, TemperatureC: ip(60), ReallocatedSectors: ip(0)}, DiskVerdictFail}, {"SATA 54 °C → ok", &SmartSummary{Health: SmartPassed, TemperatureC: ip(54)}, DiskVerdictOK}, } for _, c := range cases { if got := DiskVerdictFor(c.in, noPrior); got != c.want { t.Errorf("%s: DiskVerdictFor = %s, want %s", c.name, got.Label(), c.want.Label()) } } // The alert body must not name heat as the reason for an NVMe drive. for _, a := range DegradedAttributes(&SmartSummary{Health: SmartPassed, TemperatureC: ip(72), CriticalWarning: ip(2)}) { if a == "hőmérséklet" { t.Error("an NVMe alert names temperature as an attribute; the verdict fired on the drive's own warning") } } }