Fix tests

This commit is contained in:
Tobias Schmidt 2014-11-24 18:30:07 -05:00
commit 974f6fc762
16 changed files with 206 additions and 151 deletions

27
collector/meminfo_test.go Normal file
View 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)
}
}