Removed use of ioutil.ReadDir as it performs a stat syscall on each file which is not necerssary.

This commit is contained in:
Karim Kanso
2020-03-11 09:17:55 +00:00
parent 4f3946e673
commit b331c4c45e
3 changed files with 157 additions and 104 deletions

View File

@@ -31,7 +31,7 @@ func TestRun(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
defer mockPidList(tt.pids)()
defer mockPidList(tt.pids, t)()
for _, pid := range tt.pids {
defer mockPidCmdLine(pid, []byte("the-command"), nil, nil, t)()
defer mockPidStatus(pid, []byte{}, nil, nil, t)() // don't mock read value since it's not worth it