You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
509 B
28 lines
509 B
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)
|
|
}
|
|
}
|