MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / TestMemInfoNuma

Function TestMemInfoNuma

metric/meminfo_numa_linux_test.go:8–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestMemInfoNuma(t *testing.T) {
9 file, err := os.Open("fixtures/sys/devices/system/node/node0/meminfo")
10 if err != nil {
11 t.Fatal(err)
12 }
13 defer file.Close()
14
15 memInfo, err := parseMemInfoNuma(file)
16 if err != nil {
17 t.Fatal(err)
18 }
19
20 if want, got := 707915776.0, memInfo[5].value; want != got {
21 t.Errorf("want memory Active(anon) value %f, got %f", want, got)
22 }
23
24 if want, got := "Active_anon", memInfo[5].metricName; want != got {
25 t.Errorf("want metric Active(anon) metricName %s, got %s", want, got)
26 }
27
28 if want, got := 150994944.0, memInfo[25].value; want != got {
29 t.Errorf("want memory AnonHugePages %f, got %f", want, got)
30 }
31
32 file, err = os.Open("fixtures/sys/devices/system/node/node1/meminfo")
33 if err != nil {
34 t.Fatal(err)
35 }
36 defer file.Close()
37
38 memInfo, err = parseMemInfoNuma(file)
39 if err != nil {
40 t.Fatal(err)
41 }
42
43 if want, got := 291930112.0, memInfo[6].value; want != got {
44 t.Errorf("want memory Inactive(anon) %f, got %f", want, got)
45 }
46
47 if want, got := 85585088512.0, memInfo[13].value; want != got {
48 t.Errorf("want memory FilePages %f, got %f", want, got)
49 }
50}
51
52func TestMemInfoNumaStat(t *testing.T) {
53 file, err := os.Open("fixtures/sys/devices/system/node/node0/numastat")

Callers

nothing calls this directly

Calls 5

parseMemInfoNumaFunction · 0.85
FatalMethod · 0.80
ErrorfMethod · 0.80
CloseMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected