mirror of
https://github.com/moby/moby.git
synced 2026-08-02 22:26:52 +00:00
Adjust test to support cgroupv1
This has to be careful to do something non-destructive, which this *should* be. Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
This commit is contained in:
@@ -467,7 +467,16 @@ func TestCgroupRW(t *testing.T) {
|
||||
err = apiClient.ContainerStart(ctx, resp.ID, containertypes.StartOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
res, err := container.Exec(ctx, apiClient, resp.ID, []string{"mkdir", "/sys/fs/cgroup/foo"})
|
||||
res, err := container.Exec(ctx, apiClient, resp.ID, []string{"sh", "-ec", `
|
||||
# see also "contrib/check-config.sh" for the same test
|
||||
if [ "$(stat -f -c %t /sys/fs/cgroup 2> /dev/null)" = '63677270' ]; then
|
||||
# nice, must be cgroupsv2
|
||||
exec mkdir /sys/fs/cgroup/foo
|
||||
else
|
||||
# boo, must be cgroupsv1
|
||||
exec mkdir /sys/fs/cgroup/pids/foo
|
||||
fi
|
||||
`})
|
||||
assert.NilError(t, err)
|
||||
if tc.expectedExitCode != 0 {
|
||||
assert.Check(t, is.Contains(res.Stderr(), "Read-only file system"))
|
||||
|
||||
Reference in New Issue
Block a user