graph: add parent img refcount for faster rmi

also fix a typo in pkg/truncindex package comment

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 56f5e3459f8d7477d2aa60dee02bc7cd8a8731ad
Component: engine
This commit is contained in:
Antonio Murdaca
2015-10-09 19:13:45 +02:00
committed by Antonio Murdaca
parent f13bda05a2
commit d7d07ab148
5 changed files with 105 additions and 17 deletions

View File

@ -51,7 +51,6 @@ func (s *DockerSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *check.C) {
if strings.Contains(out, "busybox") {
c.Fatal("images should not have listed busybox")
}
}
func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
@ -204,3 +203,42 @@ func (s *DockerSuite) TestImagesWithIncorrectFilter(c *check.C) {
c.Assert(err, check.NotNil)
c.Assert(out, checker.Contains, "Invalid filter")
}
func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *check.C) {
testRequires(c, DaemonIsLinux)
dockerfile := `
FROM scratch
MAINTAINER docker
ENV foo bar`
head, out, err := buildImageWithOut("scratch-image", dockerfile, false)
c.Assert(err, check.IsNil)
split := strings.Split(out, "\n")
intermediate := strings.TrimSpace(split[5][7:])
out, _ = dockerCmd(c, "images")
if strings.Contains(out, intermediate) {
c.Fatalf("images shouldn't show non-heads images, got %s in %s", intermediate, out)
}
if !strings.Contains(out, head[:12]) {
c.Fatalf("images should contain final built images, want %s in out, got %s", head[:12], out)
}
}
func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *check.C) {
testRequires(c, DaemonIsLinux)
dockerfile := `
FROM scratch
MAINTAINER docker`
id, _, err := buildImageWithOut("scratch-image", dockerfile, false)
c.Assert(err, check.IsNil)
out, _ := dockerCmd(c, "images")
if !strings.Contains(out, id[:12]) {
c.Fatalf("images should contain images built from scratch (e.g. %s), got %s", id[:12], out)
}
}