mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #22562 from tonistiigi/fix-loopback-release
Clean loopbacks in TestDaemonNoSpaceLeftOnDeviceError
This commit is contained in:
commit
c5e3644f03
1 changed files with 10 additions and 2 deletions
|
@ -1922,16 +1922,24 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *check.C) {
|
|||
defer os.RemoveAll(testDir)
|
||||
c.Assert(mount.MakeRShared(testDir), checker.IsNil)
|
||||
defer mount.Unmount(testDir)
|
||||
defer mount.Unmount(filepath.Join(testDir, "test-mount"))
|
||||
|
||||
// create a 2MiB image 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)
|
||||
dockerCmd(c, "run", "--rm", "-v", testDir+":/test", "busybox", "sh", "-c", "dd of=/test/testfs.img bs=1M seek=2 count=0")
|
||||
out, _, err := runCommandWithOutput(exec.Command("mkfs.ext4", "-F", filepath.Join(testDir, "testfs.img"))) // `mkfs.ext4` is not in busybox
|
||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
||||
dockerCmd(c, "run", "--privileged", "--rm", "-v", testDir+":/test:shared", "busybox", "sh", "-c", "mkdir -p /test/test-mount && mount -t ext4 -no loop,rw /test/testfs.img /test/test-mount")
|
||||
|
||||
cmd := exec.Command("losetup", "-f", "--show", filepath.Join(testDir, "testfs.img"))
|
||||
loout, err := cmd.CombinedOutput()
|
||||
c.Assert(err, checker.IsNil)
|
||||
loopname := strings.TrimSpace(string(loout))
|
||||
defer exec.Command("losetup", "-d", loopname).Run()
|
||||
|
||||
dockerCmd(c, "run", "--privileged", "--rm", "-v", testDir+":/test:shared", "busybox", "sh", "-c", fmt.Sprintf("mkdir -p /test/test-mount && mount -t ext4 -no loop,rw %v /test/test-mount", loopname))
|
||||
defer mount.Unmount(filepath.Join(testDir, "test-mount"))
|
||||
|
||||
err = s.d.Start("--graph", filepath.Join(testDir, "test-mount"))
|
||||
defer s.d.Stop()
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
// pull a repository large enough to fill the mount point
|
||||
|
|
Loading…
Reference in a new issue