mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
c561212b83
Use mountinfo rather than for cgroups parsing. Make helper method private and change name. Makes method naming more explicit rather than GetThisCgroup. Use upstream term subsystem rather than cgroupType.
27 lines
415 B
Go
27 lines
415 B
Go
package cgroups
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
const (
|
|
cgroupsContents = `11:hugetlb:/
|
|
10:perf_event:/
|
|
9:blkio:/
|
|
8:net_cls:/
|
|
7:freezer:/
|
|
6:devices:/
|
|
5:memory:/
|
|
4:cpuacct,cpu:/
|
|
3:cpuset:/
|
|
2:name=systemd:/user.slice/user-1000.slice/session-16.scope`
|
|
)
|
|
|
|
func TestParseCgroups(t *testing.T) {
|
|
r := bytes.NewBuffer([]byte(cgroupsContents))
|
|
_, err := parseCgroupFile("blkio", r)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|