MCPcopy Create free account
hub / github.com/containerd/cgroups / TestParseMemoryStats

Function TestParseMemoryStats

cgroup1/memory_test.go:69–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67`
68
69func TestParseMemoryStats(t *testing.T) {
70 var (
71 c = &memoryController{}
72 m = &v1.MemoryStat{}
73 r = strings.NewReader(memoryData)
74 )
75 if err := c.parseStats(r, m); err != nil {
76 t.Fatal(err)
77 }
78 index := []uint64{
79 m.Cache,
80 m.RSS,
81 m.RSSHuge,
82 m.MappedFile,
83 m.Dirty,
84 m.Writeback,
85 m.PgPgIn,
86 m.PgPgOut,
87 m.PgFault,
88 m.PgMajFault,
89 m.InactiveAnon,
90 m.ActiveAnon,
91 m.InactiveFile,
92 m.ActiveFile,
93 m.Unevictable,
94 m.HierarchicalMemoryLimit,
95 m.HierarchicalSwapLimit,
96 m.TotalCache,
97 m.TotalRSS,
98 m.TotalRSSHuge,
99 m.TotalMappedFile,
100 m.TotalDirty,
101 m.TotalWriteback,
102 m.TotalPgPgIn,
103 m.TotalPgPgOut,
104 m.TotalPgFault,
105 m.TotalPgMajFault,
106 m.TotalInactiveAnon,
107 m.TotalActiveAnon,
108 m.TotalInactiveFile,
109 m.TotalActiveFile,
110 m.TotalUnevictable,
111 }
112 for i, v := range index {
113 if v != uint64(i)+1 {
114 t.Errorf("expected value at index %d to be %d but received %d", i, i+1, v)
115 }
116 }
117}
118
119func TestParseMemoryOomControl(t *testing.T) {
120 var (

Callers

nothing calls this directly

Calls 1

parseStatsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…