mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 20:36:21 +01:00
7569c6ce23
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
28 lines
527 B
Go
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)
|
|
}
|
|
}
|