This has to be careful to do something non-destructive, which this *should* be.
Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
| ... | ... |
@@ -467,7 +467,16 @@ func TestCgroupRW(t *testing.T) {
|
| 467 | 467 |
err = apiClient.ContainerStart(ctx, resp.ID, containertypes.StartOptions{})
|
| 468 | 468 |
assert.NilError(t, err) |
| 469 | 469 |
|
| 470 |
- res, err := container.Exec(ctx, apiClient, resp.ID, []string{"mkdir", "/sys/fs/cgroup/foo"})
|
|
| 470 |
+ res, err := container.Exec(ctx, apiClient, resp.ID, []string{"sh", "-ec", `
|
|
| 471 |
+ # see also "contrib/check-config.sh" for the same test |
|
| 472 |
+ if [ "$(stat -f -c %t /sys/fs/cgroup 2> /dev/null)" = '63677270' ]; then |
|
| 473 |
+ # nice, must be cgroupsv2 |
|
| 474 |
+ exec mkdir /sys/fs/cgroup/foo |
|
| 475 |
+ else |
|
| 476 |
+ # boo, must be cgroupsv1 |
|
| 477 |
+ exec mkdir /sys/fs/cgroup/pids/foo |
|
| 478 |
+ fi |
|
| 479 |
+ `}) |
|
| 471 | 480 |
assert.NilError(t, err) |
| 472 | 481 |
if tc.expectedExitCode != 0 {
|
| 473 | 482 |
assert.Check(t, is.Contains(res.Stderr(), "Read-only file system")) |