mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 05:31:47 +00:00
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>
This commit is contained in:
committed by
Tibor Vass
parent
7176e68625
commit
587a0ffa2d
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,3 +354,15 @@ RUN echo 2 #layer2
|
||||
c.Fatalf("%q should be allowed to untag with the -f flag", newTag)
|
||||
}
|
||||
}
|
||||
|
||||
func (*DockerSuite) TestRmiParentImageFail(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
parent, err := inspectField("busybox", "Parent")
|
||||
c.Assert(err, check.IsNil)
|
||||
out, _, err := dockerCmdWithError("rmi", parent)
|
||||
c.Assert(err, check.NotNil)
|
||||
if !strings.Contains(out, "image has dependent child images") {
|
||||
c.Fatalf("rmi should have failed because it's a parent image, got %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user