Add systemd cgroup support.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2017-09-26 06:44:30 +00:00
parent 86ee919013
commit cd57d063c5
7 changed files with 53 additions and 8 deletions

View File

@@ -161,3 +161,27 @@ func TestGetRepoDigestAndTag(t *testing.T) {
assert.Equal(t, test.expectedRepoTag, repoTag)
}
}
func TestGetCgroupsPath(t *testing.T) {
testID := "test-id"
for desc, test := range map[string]struct {
cgroupsParent string
systemdCgroup bool
expected string
}{
"should support regular cgroup path": {
cgroupsParent: "/a/b",
systemdCgroup: false,
expected: "/a/b/test-id",
},
"should support systemd cgroup path": {
cgroupsParent: "/a.slice/b.slice",
systemdCgroup: true,
expected: "b.slice:cri-containerd:test-id",
},
} {
t.Logf("TestCase %q", desc)
got := getCgroupsPath(test.cgroupsParent, testID, test.systemdCgroup)
assert.Equal(t, test.expected, got)
}
}