mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-26 13:48:59 +08:00
[process][linux] add test for missing iotime in SmartOS lx containers
This commit is contained in:
parent
0ab3954dc4
commit
e42c52cb35
@ -115,3 +115,27 @@ func Test_fillFromStatusWithContext(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_fillFromTIDStatWithContext_lx_brandz(t *testing.T) {
|
||||||
|
pids, err := ioutil.ReadDir("testdata/lx_brandz/")
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
f := common.MockEnv("HOST_PROC", "testdata/lx_brandz")
|
||||||
|
defer f()
|
||||||
|
for _, pid := range pids {
|
||||||
|
pid, err := strconv.ParseInt(pid.Name(), 0, 32)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if _, err := os.Stat(fmt.Sprintf("testdata/lx_brandz/%d/stat", pid)); err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
p, _ := NewProcess(int32(pid))
|
||||||
|
_, _, cpuTimes, _, _, _, _, err := p.fillFromTIDStatWithContext(context.Background(), -1)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
assert.Equal(t, float64(0), cpuTimes.Iowait)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
1
process/testdata/lx_brandz/1/stat
vendored
Normal file
1
process/testdata/lx_brandz/1/stat
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
1 (systemd) S 0 0 0 0 -1 0 0 0 0 0 8 15 48 52 1 0 0 0 25 31883264 1413 18446744073709551615 0 0 140737487261696 0 0 0 0 0 0 18446741901776689794 0 0 17 0
|
Loading…
x
Reference in New Issue
Block a user