Fix tests
This commit is contained in:
parent
d06281286d
commit
974f6fc762
16 changed files with 206 additions and 151 deletions
27
collector/meminfo_test.go
Normal file
27
collector/meminfo_test.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package collector
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMemInfo(t *testing.T) {
|
||||
file, err := os.Open("fixtures/meminfo")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
memInfo, err := parseMemInfo(file)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if want, got := 3831959552.0, memInfo["MemTotal"]; want != got {
|
||||
t.Errorf("want memory total %f, got %f", want, got)
|
||||
}
|
||||
|
||||
if want, got := 3787456512.0, memInfo["DirectMap2M"]; want != got {
|
||||
t.Errorf("want memory directMap2M %f, got %f", want, got)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue