package web import ( "context" "testing" "gitea.dooplex.hu/admin/felhom-controller/internal/agentapi" ) // R-568: the agent answers /disks in an order that is not stable between calls; the card listed // the same two disks in the opposite order a minute apart. Feed both orders and expect ONE order. func TestDiskHealthRows_OrderIsStable(t *testing.T) { ok := &agentapi.SmartSummary{Health: agentapi.SmartPassed} a := physDisk("nvme0n1", ok) b := physDisk("sda", ok) labels := func(order ...agentapi.DiskInfo) []string { h := newDiskHarness(t) // fresh harness: the 60 s card cache must not answer for the second order h.set(order...) var out []string for _, r := range h.s.diskHealthRows(context.Background()) { out = append(out, r.Label) } return out } ab := labels(a, b) ba := labels(b, a) if len(ab) != 2 || len(ba) != 2 { t.Fatalf("want two rows each, got %v and %v", ab, ba) } if ab[0] != ba[0] || ab[1] != ba[1] { t.Errorf("R-568: the same two disks render in a different order depending on the agent's order: %v vs %v", ab, ba) } }