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

Function TestMemoryController_Stat

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

Source from the content-addressed store, hash-verified

138}
139
140func TestMemoryController_Stat(t *testing.T) {
141 // GIVEN a cgroups folder with all the memory metrics
142 modules := []string{"", "memsw", "kmem", "kmem.tcp"}
143 metrics := []string{"usage_in_bytes", "max_usage_in_bytes", "failcnt", "limit_in_bytes"}
144 tmpRoot := buildMemoryMetrics(t, modules, metrics)
145
146 // WHEN the memory controller reads the metrics stats
147 mc := NewMemory(tmpRoot)
148 stats := v1.Metrics{}
149 if err := mc.Stat("", &stats); err != nil {
150 t.Errorf("can't get stats: %v", err)
151 }
152
153 // THEN all the memory stats have been completely loaded in memory
154 checkMemoryStatIsComplete(t, stats.Memory)
155}
156
157func TestMemoryController_Stat_IgnoreModules(t *testing.T) {
158 // GIVEN a cgroups folder that accounts for all the metrics BUT swap memory

Callers

nothing calls this directly

Calls 4

buildMemoryMetricsFunction · 0.85
NewMemoryFunction · 0.85
StatMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…