(t *testing.T)
| 189 | } |
| 190 | |
| 191 | func TestMemoryController_Stat_OptionalSwap_NoSwap(t *testing.T) { |
| 192 | // GIVEN a cgroups folder that accounts for all the metrics BUT swap memory |
| 193 | modules := []string{"", "kmem", "kmem.tcp"} |
| 194 | metrics := []string{"usage_in_bytes", "max_usage_in_bytes", "failcnt", "limit_in_bytes"} |
| 195 | tmpRoot := buildMemoryMetrics(t, modules, metrics) |
| 196 | |
| 197 | // WHEN a memory controller that ignores swap only if it is missing reads stats |
| 198 | mc := NewMemory(tmpRoot, OptionalSwap()) |
| 199 | stats := v1.Metrics{} |
| 200 | if err := mc.Stat("", &stats); err != nil { |
| 201 | t.Errorf("can't get stats: %v", err) |
| 202 | } |
| 203 | |
| 204 | // THEN the swap memory stats are not loaded but all the other memory metrics are |
| 205 | checkMemoryStatHasNoSwap(t, stats.Memory) |
| 206 | } |
| 207 | |
| 208 | func checkMemoryStatIsComplete(t *testing.T, mem *v1.MemoryStat) { |
| 209 | index := []uint64{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…