1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Adding test for the fix #17168.

The test case creates a mount point, starts the daemon with the
graph dir pointing to the mount and initates a pull request. We should
be able to check for the error message when the mount point gets filled
during pull.

Signed-off-by: Anil Belur <askb23@gmail.com>
This commit is contained in:
Anil Belur 2015-11-13 11:23:35 +05:30
parent 31cdc63419
commit 4699ef8f87

View file

@ -1880,3 +1880,30 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *check.C)
cont++
}
}
// Test daemon for no space left on device error
func (s *DockerDaemonSuite) TestDaemonNoSpaceleftOnDeviceError(c *check.C) {
// create a 2MiB image and mount it as graph root
cmd := exec.Command("dd", "of=/tmp/testfs.img", "bs=1M", "seek=2", "count=0")
if err := cmd.Run(); err != nil {
c.Fatalf("dd failed: %v", err)
}
cmd = exec.Command("mkfs.ext4", "-F", "/tmp/testfs.img")
if err := cmd.Run(); err != nil {
c.Fatalf("mkfs.ext4 failed: %v", err)
}
cmd = exec.Command("mkdir", "-p", "/tmp/testfs-mount")
if err := cmd.Run(); err != nil {
c.Fatalf("mkdir failed: %v", err)
}
cmd = exec.Command("mount", "-t", "ext4", "-no", "loop,rw", "/tmp/testfs.img", "/tmp/testfs-mount")
if err := cmd.Run(); err != nil {
c.Fatalf("mount failed: %v", err)
}
err := s.d.Start("--graph", "/tmp/testfs-mount")
c.Assert(err, check.IsNil)
// pull a repository large enough to fill the mount point
out, err := s.d.Cmd("pull", "registry:2")
c.Assert(out, check.Not(check.Equals), 1, check.Commentf("no space left on device"))
}