diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index 36237621e2..a3823b1293 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -1646,16 +1646,15 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) { assert.Assert(c, mount.MakeRShared(testDir) == nil) defer mount.Unmount(testDir) - // create a 3MiB image (with a 2MiB ext4 fs) and mount it as graph root - // - // Why in a container? Because `mount` sometimes behaves weirdly and often - // fails outright on this test in debian:jessie (which is what the test suite - // runs under if run from the Makefile at the time this patch was added). - cli.DockerCmd(c, "run", "--rm", "-v", testDir+":/test", "busybox", "sh", "-c", "dd of=/test/testfs.img bs=1M seek=3 count=0") - icmd.RunCommand("mkfs.ext4", "-F", filepath.Join(testDir, "testfs.img")).Assert(c, icmd.Success) + // create a 3MiB image (with a 2MiB ext4 fs) and mount it as storage root + storageFS := filepath.Join(testDir, "testfs.img") + icmd.RunCommand("dd", "of="+storageFS, "bs=1M", "seek=3", "count=0").Assert(c, icmd.Success) + icmd.RunCommand("mkfs.ext4", "-F", storageFS).Assert(c, icmd.Success) - cli.DockerCmd(c, "run", "--privileged", "--rm", "-v", testDir+":/test:shared", "busybox", "sh", "-c", "mkdir -p /test/test-mount && mount -n -t ext4 /test/testfs.img /test/test-mount") - defer mount.Unmount(filepath.Join(testDir, "test-mount")) + testMount, err := os.MkdirTemp(testDir, "test-mount") + assert.NilError(c, err) + icmd.RunCommand("mount", "-n", "-t", "ext4", storageFS, testMount).Assert(c, icmd.Success) + defer mount.Unmount(testMount) driver := "vfs" if testEnv.UsingSnapshotter() { @@ -1663,11 +1662,11 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) { } s.d.Start(c, - "--data-root", filepath.Join(testDir, "test-mount"), + "--data-root", testMount, "--storage-driver", driver, // Pass empty containerd socket to force daemon to create a new - // supervised containerd daemon. Otherwise the global containerd daemon + // supervised containerd daemon, otherwise the global containerd daemon // will be used and its data won't be stored in the specified data-root. "--containerd", "", )