Prechádzať zdrojové kódy

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>
Paweł Gronowski 1 rok pred
rodič
commit
1f6bacc486
1 zmenil súbory, kde vykonal 17 pridanie a 4 odobranie
  1. 17 4
      integration-cli/docker_cli_daemon_test.go

+ 17 - 4
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