|
|
|
@ -33,8 +33,8 @@ func TestVirtual_memory(t *testing.T) {
|
|
|
|
|
totalStr = "used + available"
|
|
|
|
|
}
|
|
|
|
|
if runtime.GOOS == "freebsd" {
|
|
|
|
|
total = v.Used + v.Free + v.Cached + v.Inactive
|
|
|
|
|
totalStr = "used + free + cached + inactive"
|
|
|
|
|
total = v.Used + v.Free + v.Cached + v.Inactive + v.Laundry
|
|
|
|
|
totalStr = "used + free + cached + inactive + laundry"
|
|
|
|
|
}
|
|
|
|
|
assert.Equal(t, v.Total, total,
|
|
|
|
|
"Total should be computable (%v): %v", totalStr, v)
|
|
|
|
@ -71,7 +71,7 @@ func TestVirtualMemoryStat_String(t *testing.T) {
|
|
|
|
|
UsedPercent: 30.1,
|
|
|
|
|
Free: 40,
|
|
|
|
|
}
|
|
|
|
|
e := `{"total":10,"available":20,"used":30,"usedPercent":30.1,"free":40,"active":0,"inactive":0,"wired":0,"buffers":0,"cached":0,"writeback":0,"dirty":0,"writebacktmp":0,"shared":0,"slab":0,"pagetables":0,"swapcached":0,"commitlimit":0,"committedas":0,"hightotal":0,"highfree":0,"lowtotal":0,"lowfree":0,"swaptotal":0,"swapfree":0,"mapped":0,"vmalloctotal":0,"vmallocused":0,"vmallocchunk":0,"hugepagestotal":0,"hugepagesfree":0,"hugepagesize":0}`
|
|
|
|
|
e := `{"total":10,"available":20,"used":30,"usedPercent":30.1,"free":40,"active":0,"inactive":0,"wired":0,"laundry":0,"buffers":0,"cached":0,"writeback":0,"dirty":0,"writebacktmp":0,"shared":0,"slab":0,"pagetables":0,"swapcached":0,"commitlimit":0,"committedas":0,"hightotal":0,"highfree":0,"lowtotal":0,"lowfree":0,"swaptotal":0,"swapfree":0,"mapped":0,"vmalloctotal":0,"vmallocused":0,"vmallocchunk":0,"hugepagestotal":0,"hugepagesfree":0,"hugepagesize":0}`
|
|
|
|
|
if e != fmt.Sprintf("%v", v) {
|
|
|
|
|
t.Errorf("VirtualMemoryStat string is invalid: %v", v)
|
|
|
|
|
}
|
|
|
|
|