(t *testing.T)
| 172 | } |
| 173 | |
| 174 | func TestMemoryController_Stat_OptionalSwap_HasSwap(t *testing.T) { |
| 175 | // GIVEN a cgroups folder with all the memory metrics |
| 176 | modules := []string{"", "memsw", "kmem", "kmem.tcp"} |
| 177 | metrics := []string{"usage_in_bytes", "max_usage_in_bytes", "failcnt", "limit_in_bytes"} |
| 178 | tmpRoot := buildMemoryMetrics(t, modules, metrics) |
| 179 | |
| 180 | // WHEN a memory controller that ignores swap only if it is missing reads stats |
| 181 | mc := NewMemory(tmpRoot, OptionalSwap()) |
| 182 | stats := v1.Metrics{} |
| 183 | if err := mc.Stat("", &stats); err != nil { |
| 184 | t.Errorf("can't get stats: %v", err) |
| 185 | } |
| 186 | |
| 187 | // THEN all the memory stats have been completely loaded in memory |
| 188 | checkMemoryStatIsComplete(t, stats.Memory) |
| 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…