node_exporter/collector/filefd_linux_test.go
Ken Herner 7569c6ce23 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
2015-09-10 10:27:58 -04:00

28 lines
527 B
Go

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)
}
}