(t *testing.T)
| 138 | } |
| 139 | |
| 140 | func 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 | |
| 157 | func TestMemoryController_Stat_IgnoreModules(t *testing.T) { |
| 158 | // GIVEN a cgroups folder that accounts for all the metrics BUT swap memory |
nothing calls this directly
no test coverage detected
searching dependent graphs…