Fix scanner usage without error handling
This commit is contained in:
parent
d1dfda86ee
commit
084e585c2a
11 changed files with 33 additions and 38 deletions
|
|
@ -13,28 +13,19 @@
|
|||
|
||||
package collector
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
import "testing"
|
||||
|
||||
func TestFileFDStats(t *testing.T) {
|
||||
file, err := os.Open("fixtures/proc/sys/fs/file-nr")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
fileFDStats, err := parseFileFDStats(file, fileName)
|
||||
fileFDStats, err := parseFileFDStats("fixtures/proc/sys/fs/file-nr")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := "1024", fileFDStats["allocated"]; want != got {
|
||||
t.Errorf("want filefd allocated %s, got %s", want, got)
|
||||
t.Errorf("want filefd allocated %q, got %q", want, got)
|
||||
}
|
||||
|
||||
if want, got := "1631329", fileFDStats["maximum"]; want != got {
|
||||
t.Errorf("want filefd maximum %s, got %s", want, got)
|
||||
t.Errorf("want filefd maximum %q, got %q", want, got)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue