We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a5aa82 commit 2198573Copy full SHA for 2198573
pkg/procInfo_test.go
@@ -0,0 +1,38 @@
1
+package psutils
2
+
3
+import (
4
+ "testing"
5
6
+ "github.com/stretchr/testify/assert"
7
+)
8
9
+var procStatus string = `Name: Anything
10
+Umask: 0000
11
+State: R (Running)
12
+Tgid: 4085954
13
+Ngid: 0
14
+Pid: 5
15
+PPid: 2
16
+TracerPid: 0
17
+Uid: 0 0 0 0
18
+Gid: 0 0 0 0
19
+FDSize: 64`
20
21
+type spyProcLoader struct{}
22
23
+func (l *spyProcLoader) Load(string) (string, error) {
24
+ return procStatus, nil
25
+}
26
+func TestGetProcList(t *testing.T) {
27
+ var _ Loader = (*spyProcLoader)(nil)
28
+ got, err := getProcessList(&spyProcLoader{})
29
+ if err != nil {
30
+ t.Errorf("%v", err)
31
+ }
32
+ expected := Process{
33
+ PID: 5,
34
+ ProcessName: "Anything",
35
36
+ assert.Equal(t, expected, got[0])
37
38
0 commit comments