1
0
mirror of https://github.com/moby/moby.git synced 2025-07-29 07:21:35 +03:00

Clean more build utils in integration cli

- Remove deprecated buildImage* functions
- Rename buildImageNew to buildImage
- Use *check.C in fakeContext* setup and in getIdByName

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester
2017-01-16 11:30:14 +01:00
parent 8c7651998f
commit c10f6ef43f
28 changed files with 587 additions and 1194 deletions

View File

@ -147,8 +147,8 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
// See https://github.com/docker/docker/issues/14116
func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c *check.C) {
dockerfile := "FROM busybox\nRUN echo test 14116\n"
imgID, err := buildImage("test-14116", dockerfile, false)
c.Assert(err, checker.IsNil)
buildImageSuccessfully(c, "test-14116", withDockerfile(dockerfile))
imgID := getIDByName(c, "test-14116")
newTag := "newtag"
dockerCmd(c, "tag", imgID, newTag)
@ -205,14 +205,8 @@ func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *check.C) {
tag1 := imageName + ":tag1"
tag2 := imageName + ":tag2"
_, err := buildImage(tag1,
`FROM busybox
MAINTAINER "docker"`,
true)
if err != nil {
c.Fatal(err)
}
buildImageSuccessfully(c, tag1, withDockerfile(`FROM busybox
MAINTAINER "docker"`))
dockerCmd(c, "tag", tag1, tag2)
out, _ := dockerCmd(c, "rmi", "-f", tag2)
@ -240,8 +234,8 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) {
imageIds := make([]string, 2)
for i, name := range imageNames {
dockerfile := fmt.Sprintf("FROM busybox\nMAINTAINER %s\nRUN echo %s\n", name, name)
id, err := buildImage(name, dockerfile, false)
c.Assert(err, checker.IsNil)
buildImageSuccessfully(c, name, withoutCache, withDockerfile(dockerfile))
id := getIDByName(c, name)
imageIds[i] = id
}
@ -269,9 +263,7 @@ RUN echo 0 #layer0
RUN echo 1 #layer1
RUN echo 2 #layer2
`
_, err := buildImage(image, dockerfile, false)
c.Assert(err, checker.IsNil)
buildImageSuccessfully(c, image, withoutCache, withDockerfile(dockerfile))
out, _ := dockerCmd(c, "history", "-q", image)
ids := strings.Split(out, "\n")
idToTag := ids[2]
@ -294,7 +286,7 @@ RUN echo 2 #layer2
// At this point we have 2 containers, one based on layer2 and another based on layer0.
// Try to untag "tmp2" without the -f flag.
out, _, err = dockerCmdWithError("rmi", newTag)
out, _, err := dockerCmdWithError("rmi", newTag)
// should not be untagged without the -f flag
c.Assert(err, checker.NotNil)
c.Assert(out, checker.Contains, cid[:12])
@ -307,10 +299,9 @@ RUN echo 2 #layer2
}
func (*DockerSuite) TestRmiParentImageFail(c *check.C) {
_, err := buildImage("test", `
buildImageSuccessfully(c, "test", withDockerfile(`
FROM busybox
RUN echo hello`, false)
c.Assert(err, checker.IsNil)
RUN echo hello`))
id := inspectField(c, "busybox", "ID")
out, _, err := dockerCmdWithError("rmi", id)