(t *testing.T)
| 155 | } |
| 156 | |
| 157 | func TestMemoryController_Stat_IgnoreModules(t *testing.T) { |
| 158 | // GIVEN a cgroups folder that accounts for all the metrics BUT swap memory |
| 159 | modules := []string{"", "kmem", "kmem.tcp"} |
| 160 | metrics := []string{"usage_in_bytes", "max_usage_in_bytes", "failcnt", "limit_in_bytes"} |
| 161 | tmpRoot := buildMemoryMetrics(t, modules, metrics) |
| 162 | |
| 163 | // WHEN the memory controller explicitly ignores memsw module and reads the data |
| 164 | mc := NewMemory(tmpRoot, IgnoreModules("memsw")) |
| 165 | stats := v1.Metrics{} |
| 166 | if err := mc.Stat("", &stats); err != nil { |
| 167 | t.Errorf("can't get stats: %v", err) |
| 168 | } |
| 169 | |
| 170 | // THEN the swap memory stats are not loaded but all the other memory metrics are |
| 171 | checkMemoryStatHasNoSwap(t, stats.Memory) |
| 172 | } |
| 173 | |
| 174 | func TestMemoryController_Stat_OptionalSwap_HasSwap(t *testing.T) { |
| 175 | // GIVEN a cgroups folder with all the memory metrics |
nothing calls this directly
no test coverage detected
searching dependent graphs…