[process][linux] add test for missing iotime in SmartOS lx containers

This commit is contained in:
Lars Meyer 2021-06-04 10:36:22 +02:00
parent 0ab3954dc4
commit e42c52cb35
2 changed files with 25 additions and 0 deletions

View File

@ -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
View 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