mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-19 15:24:26 +01:00
virtcontainers: Convert to the new cgroups package API
The new API is based on containerd's cgroups package. With that conversion we can simpligy the virtcontainers sandbox code and also uniformize our cgroups external API dependency. We now only depend on containerd/cgroups for everything cgroups related. Depends-on: github.com/kata-containers/tests#3805 Signed-off-by: Samuel Ortiz <samuel.e.ortiz@protonmail.com> Signed-off-by: Eric Ernst <eric_ernst@apple.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
b42ed39349
commit
9bed2ade0f
@@ -62,6 +62,8 @@ func TestValidCgroupPath(t *testing.T) {
|
||||
{"/../hi", false, false},
|
||||
{"/../hi/foo", false, false},
|
||||
{"o / m /../ g", false, false},
|
||||
{"/overhead/foobar", false, false},
|
||||
{"/sys/fs/cgroup/cpu/sandbox/kata_foobar", false, false},
|
||||
|
||||
// invalid systemd paths
|
||||
{"o / m /../ g", true, true},
|
||||
@@ -93,13 +95,13 @@ func TestValidCgroupPath(t *testing.T) {
|
||||
if filepath.IsAbs(t.path) {
|
||||
cleanPath := filepath.Dir(filepath.Clean(t.path))
|
||||
assert.True(strings.HasPrefix(path, cleanPath),
|
||||
"%v should have prefix %v", cleanPath)
|
||||
"%v should have prefix %v", path, cleanPath)
|
||||
} else if t.systemdCgroup {
|
||||
assert.Equal(t.path, path)
|
||||
} else {
|
||||
assert.True(strings.HasPrefix(path, "/"+CgroupKataPrefix) ||
|
||||
assert.True(
|
||||
strings.HasPrefix(path, DefaultCgroupPath),
|
||||
"%v should have prefix /%v or %v", path, CgroupKataPrefix, DefaultCgroupPath)
|
||||
"%v should have prefix /%v", path, DefaultCgroupPath)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user