Node_Exporter/collector/meminfo_test.go
Tobias Schmidt 974f6fc762 Fix tests
2014-11-24 18:34:02 -05:00

28 lines
509 B
Go

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