diff options
author | Ken Herner <chosenken@gmail.com> | 2015-09-08 10:14:18 -0400 |
---|---|---|
committer | Ken Herner <chosenken@gmail.com> | 2015-09-10 10:27:58 -0400 |
commit | 7569c6ce23af643dea396626f2b1015a46c79f76 (patch) | |
tree | ca5161b08cc3d57f95adf64564443fcf91fd72e9 /collector/filefd_linux_test.go | |
parent | 6f17231e44466cf2059e0705628c9e5a95bbb8fd (diff) | |
download | prometheus_node_collector-7569c6ce23af643dea396626f2b1015a46c79f76.tar.bz2 prometheus_node_collector-7569c6ce23af643dea396626f2b1015a46c79f76.tar.xz prometheus_node_collector-7569c6ce23af643dea396626f2b1015a46c79f76.zip |
Initial implementation of file-nr
Fixed file-nr update function
Fixed file-nr test case
Fixed file-nr test case again
Fixed file-nr separator to tab
Updated file-nr to filenr.
Updated file-nr to filenr.
Fixed file-nr test cases, added comments
Remove reporting the second value from file-nr as it will alwasy be zero in linux 2.6 and greator
Renaming file-nr to filefd
Updated build constraint
Updates and code cleanup for filefd.
Updated enabledCollectors with the correct name for filefd
Fixed filefd test wording
Diffstat (limited to 'collector/filefd_linux_test.go')
-rw-r--r-- | collector/filefd_linux_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/collector/filefd_linux_test.go b/collector/filefd_linux_test.go new file mode 100644 index 0000000..31e4811 --- /dev/null +++ b/collector/filefd_linux_test.go | |||
@@ -0,0 +1,27 @@ | |||
1 | package collector | ||
2 | |||
3 | import ( | ||
4 | "os" | ||
5 | "testing" | ||
6 | ) | ||
7 | |||
8 | func TestFileFDStats(t *testing.T) { | ||
9 | file, err := os.Open("fixtures/file-nr") | ||
10 | if err != nil { | ||
11 | t.Fatal(err) | ||
12 | } | ||
13 | defer file.Close() | ||
14 | |||
15 | fileFDStats, err := parseFileFDStats(file, fileName) | ||
16 | if err != nil { | ||
17 | t.Fatal(err) | ||
18 | } | ||
19 | |||
20 | if want, got := "1024", fileFDStats["allocated"]; want != got { | ||
21 | t.Errorf("want filefd allocated %s, got %s", want, got) | ||
22 | } | ||
23 | |||
24 | if want, got := "1631329", fileFDStats["maximum"]; want != got { | ||
25 | t.Errorf("want filefd maximum %s, got %s", want, got) | ||
26 | } | ||
27 | } | ||