package storage import ( "os" "testing" ) // The /sys fallback must find the same disks and partitions lsblk does. func TestSysBlockDevices(t *testing.T) { if _, err := os.Stat("/sys/block"); err != nil { t.Skip("no /sys/block") } for _, d := range sysBlockDevices() { if d.Name == "" || d.Type != "disk" { t.Fatalf("bad node %+v", d) } t.Logf("%s size=%d tran=%s rota=%v parts=%d", d.Name, d.Size, str(d.Tran), d.Rota, len(d.Children)) for _, c := range d.Children { t.Logf(" %s size=%d fs=%s mount=%s", c.Name, c.Size, str(c.FSType), str(c.Mountpoint)) } } }