From 1f6bacc4869e0a1774717c26809660e09cef4fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Wed, 4 Oct 2023 15:21:43 +0200 Subject: [PATCH] TestDaemonNoSpaceLeftOnDeviceError: Adjust to snapshotters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Pass empty containerd socket which forces the daemon to create a new supervised containerd. Otherwise a global containerd daemon will be used and the pulled image data will be stored in its data directory, instead of the the newly specified `data-root` that has a limited storage capacity. - Don't try to use `vfs` snapshotter, instead use `native` which is containerd's equivalent for `vfs`. Signed-off-by: Paweł Gronowski --- integration-cli/docker_cli_daemon_test.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index b8cbfc73b6..78bd9d3a87 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -1629,16 +1629,29 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) { 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) - dockerCmd(c, "run", "--privileged", "--rm", "-v", testDir+":/test:shared", "busybox", "sh", "-c", "mkdir -p /test/test-mount/vfs && mount -n -t ext4 /test/testfs.img /test/test-mount/vfs") + 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")) - s.d.Start(c, "--storage-driver", "vfs", "--data-root", filepath.Join(testDir, "test-mount")) + driver := "vfs" + if testEnv.UsingSnapshotter() { + driver = "native" + } + + s.d.Start(c, + "--data-root", filepath.Join(testDir, "test-mount"), + "--storage-driver", driver, + + // Pass empty containerd socket to force daemon to create a new + // supervised containerd daemon. Otherwise the global containerd daemon + // will be used and its data won't be stored in the specified data-root. + "--containerd", "", + ) defer s.d.Stop(c) // pull a repository large enough to overfill the mounted filesystem pullOut, err := s.d.Cmd("pull", "debian:bullseye-slim") - assert.Assert(c, err != nil, pullOut) - assert.Assert(c, strings.Contains(pullOut, "no space left on device")) + assert.Check(c, err != nil) + assert.Check(c, is.Contains(pullOut, "no space left on device")) } // Test daemon restart with container links + auto restart