libct/cgroupv1: fix TestGetCgroupMounts test cases
When testing GetCgroupMounts, the map data is supposed to be obtained from /proc/self/cgroup, but since we're mocking things, we provide our own map. Unfortunately, not all controllers existing in mountinfos were listed. Also, "name=systemd" needs special handling, so add it. The controllers added were: * for fedoraMountinfo case: name=systemd * for systemdMountinfo case: name=systemd, net_prio * for bedrockMountinfo case: name=systemd, net_prio, pids Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
0681d456fc
commit
0626c150c1
|
@ -189,46 +189,52 @@ func TestGetCgroupMounts(t *testing.T) {
|
|||
mountInfo: fedoraMountinfo,
|
||||
root: "/",
|
||||
subsystems: map[string]bool{
|
||||
"cpuset": false,
|
||||
"cpu": false,
|
||||
"cpuacct": false,
|
||||
"memory": false,
|
||||
"devices": false,
|
||||
"freezer": false,
|
||||
"net_cls": false,
|
||||
"blkio": false,
|
||||
"perf_event": false,
|
||||
"hugetlb": false,
|
||||
"name=systemd": false,
|
||||
"cpuset": false,
|
||||
"cpu": false,
|
||||
"cpuacct": false,
|
||||
"memory": false,
|
||||
"devices": false,
|
||||
"freezer": false,
|
||||
"net_cls": false,
|
||||
"blkio": false,
|
||||
"perf_event": false,
|
||||
"hugetlb": false,
|
||||
},
|
||||
},
|
||||
{
|
||||
mountInfo: systemdMountinfo,
|
||||
root: "/system.slice/docker-dc4eaa1a34ec4d593bc0125d31eea823a1d76ae483aeb1409cca80304e34da2e.scope",
|
||||
subsystems: map[string]bool{
|
||||
"cpuset": false,
|
||||
"cpu": false,
|
||||
"cpuacct": false,
|
||||
"memory": false,
|
||||
"devices": false,
|
||||
"freezer": false,
|
||||
"net_cls": false,
|
||||
"blkio": false,
|
||||
"perf_event": false,
|
||||
"name=systemd": false,
|
||||
"cpuset": false,
|
||||
"cpu": false,
|
||||
"cpuacct": false,
|
||||
"memory": false,
|
||||
"devices": false,
|
||||
"freezer": false,
|
||||
"net_cls": false,
|
||||
"net_prio": false,
|
||||
"blkio": false,
|
||||
"perf_event": false,
|
||||
},
|
||||
},
|
||||
{
|
||||
mountInfo: bedrockMountinfo,
|
||||
root: "/",
|
||||
subsystems: map[string]bool{
|
||||
"cpuset": false,
|
||||
"cpu": false,
|
||||
"cpuacct": false,
|
||||
"memory": false,
|
||||
"devices": false,
|
||||
"freezer": false,
|
||||
"net_cls": false,
|
||||
"blkio": false,
|
||||
"perf_event": false,
|
||||
"name=systemd": false,
|
||||
"cpuset": false,
|
||||
"cpu": false,
|
||||
"cpuacct": false,
|
||||
"memory": false,
|
||||
"devices": false,
|
||||
"freezer": false,
|
||||
"net_cls": false,
|
||||
"net_prio": false,
|
||||
"blkio": false,
|
||||
"perf_event": false,
|
||||
"pids": false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -245,6 +251,7 @@ func TestGetCgroupMounts(t *testing.T) {
|
|||
}
|
||||
}
|
||||
for ss := range td.subsystems {
|
||||
ss = strings.TrimPrefix(ss, CgroupNamePrefix)
|
||||
m, ok := cgMap[ss]
|
||||
if !ok {
|
||||
t.Fatalf("%s not found", ss)
|
||||
|
|
Loading…
Reference in New Issue