un-containerize TestDaemonNoSpaceLeftOnDeviceError

Commit 59b83d8aae containerized these steps,
as they didn't work well on Debian Jessie:

> Because the `mount` here will sometimes fail when run in `debian:jessie`,
> which is what the environrment hosting the test suite is running if run
> from the `Makefile`.
> Also, why the heck not containerize it, all the things.

Follow-up commits, such as 228d74842f, and
1c5806cf57 updated the Debian distro, but
also updated this comment, losing the original context (the issue was
(originally) related to Debian Jessie).

This patch changes the test back to not use containers, which seems to
work fine (at least "it worked on my machine").

    make TEST_IGNORE_CGROUP_CHECK=1 TEST_FILTER=TestDaemonNoSpaceLeftOnDeviceError DOCKER_GRAPHDRIVER=overlay2 test-integration

    === RUN   TestDockerDaemonSuite/TestDaemonNoSpaceLeftOnDeviceError
        check_test.go:589: [df36ad96a412b] daemon is not started
    --- PASS: TestDockerDaemonSuite (5.12s)
        --- PASS: TestDockerDaemonSuite/TestDaemonNoSpaceLeftOnDeviceError (5.12s)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-11-24 13:35:26 +01:00
parent df59a357ec
commit aa2fa2caa3
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -1646,16 +1646,15 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
assert.Assert(c, mount.MakeRShared(testDir) == nil) assert.Assert(c, mount.MakeRShared(testDir) == nil)
defer mount.Unmount(testDir) defer mount.Unmount(testDir)
// create a 3MiB image (with a 2MiB ext4 fs) and mount it as graph root // create a 3MiB image (with a 2MiB ext4 fs) and mount it as storage root
// storageFS := filepath.Join(testDir, "testfs.img")
// Why in a container? Because `mount` sometimes behaves weirdly and often icmd.RunCommand("dd", "of="+storageFS, "bs=1M", "seek=3", "count=0").Assert(c, icmd.Success)
// fails outright on this test in debian:jessie (which is what the test suite icmd.RunCommand("mkfs.ext4", "-F", storageFS).Assert(c, icmd.Success)
// 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)
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") testMount, err := os.MkdirTemp(testDir, "test-mount")
defer mount.Unmount(filepath.Join(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" driver := "vfs"
if testEnv.UsingSnapshotter() { if testEnv.UsingSnapshotter() {
@ -1663,11 +1662,11 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
} }
s.d.Start(c, s.d.Start(c,
"--data-root", filepath.Join(testDir, "test-mount"), "--data-root", testMount,
"--storage-driver", driver, "--storage-driver", driver,
// Pass empty containerd socket to force daemon to create a new // 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. // will be used and its data won't be stored in the specified data-root.
"--containerd", "", "--containerd", "",
) )