TestDaemonNoSpaceLeftOnDeviceError: Adjust to snapshotters

- 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 <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2023-10-04 15:21:43 +02:00
parent bc2c8279de
commit 1f6bacc486
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -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") 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) 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")) 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) defer s.d.Stop(c)
// pull a repository large enough to overfill the mounted filesystem // pull a repository large enough to overfill the mounted filesystem
pullOut, err := s.d.Cmd("pull", "debian:bullseye-slim") pullOut, err := s.d.Cmd("pull", "debian:bullseye-slim")
assert.Assert(c, err != nil, pullOut) assert.Check(c, err != nil)
assert.Assert(c, strings.Contains(pullOut, "no space left on device")) assert.Check(c, is.Contains(pullOut, "no space left on device"))
} }
// Test daemon restart with container links + auto restart // Test daemon restart with container links + auto restart