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
This commit is contained in:
Ken Herner 2015-09-08 10:14:18 -04:00
commit 7569c6ce23
4 changed files with 113 additions and 1 deletions

View file

@ -0,0 +1,27 @@
package collector
import (
"os"
"testing"
)
func TestFileFDStats(t *testing.T) {
file, err := os.Open("fixtures/file-nr")
if err != nil {
t.Fatal(err)
}
defer file.Close()
fileFDStats, err := parseFileFDStats(file, fileName)
if err != nil {
t.Fatal(err)
}
if want, got := "1024", fileFDStats["allocated"]; want != got {
t.Errorf("want filefd allocated %s, got %s", want, got)
}
if want, got := "1631329", fileFDStats["maximum"]; want != got {
t.Errorf("want filefd maximum %s, got %s", want, got)
}
}