mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 20:50:06 +00:00
fix(status): improve disk card display refs #551
This commit is contained in:
60
cmd/status/metrics_disk_test.go
Normal file
60
cmd/status/metrics_disk_test.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/shirou/gopsutil/v4/disk"
|
||||
)
|
||||
|
||||
func TestShouldSkipDiskPartition(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
part disk.PartitionStat
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "keep local apfs root volume",
|
||||
part: disk.PartitionStat{
|
||||
Device: "/dev/disk3s1s1",
|
||||
Mountpoint: "/",
|
||||
Fstype: "apfs",
|
||||
},
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "skip macfuse mirror mount",
|
||||
part: disk.PartitionStat{
|
||||
Device: "kaku-local:/",
|
||||
Mountpoint: "/Users/tw93/Library/Caches/dev.kaku/sshfs/kaku-local",
|
||||
Fstype: "macfuse",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "skip smb share",
|
||||
part: disk.PartitionStat{
|
||||
Device: "//server/share",
|
||||
Mountpoint: "/Volumes/share",
|
||||
Fstype: "smbfs",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "skip system volume",
|
||||
part: disk.PartitionStat{
|
||||
Device: "/dev/disk3s5",
|
||||
Mountpoint: "/System/Volumes/Data",
|
||||
Fstype: "apfs",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := shouldSkipDiskPartition(tt.part); got != tt.want {
|
||||
t.Fatalf("shouldSkipDiskPartition(%+v) = %v, want %v", tt.part, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user