Fix issue where build steps are duplicated in the output
This fixes an issue where the build output for the "Steps" would look like: ``` Step 1: RUN echo hi echo hi ``` instead of ``` Step 1: RUN echo hi ``` Also, I noticed that there were no checks to make sure invalid Dockerfile cmd flags were caught on cmds that didn't use cmd flags at all. They would have been caught on the cmds that had flags, but cmds that didn't bother to add a new code for flags would have just ignored them. So, I added checks to each cmd to flag it. Added testcases for issues. Signed-off-by: Doug Davis <dug@us.ibm.com> Upstream-commit: 08b7f30fcd050244026098673b19700485308b5a Component: engine
This commit is contained in:
@ -5349,3 +5349,38 @@ RUN cat /proc/self/cgroup
|
||||
c.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildNoDupOutput(c *check.C) {
|
||||
// Check to make sure our build output prints the Dockerfile cmd
|
||||
// property - there was a bug that caused it to be duplicated on the
|
||||
// Step X line
|
||||
name := "testbuildnodupoutput"
|
||||
|
||||
_, out, err := buildImageWithOut(name, `
|
||||
FROM busybox
|
||||
RUN env`, false)
|
||||
if err != nil {
|
||||
c.Fatalf("Build should have worked: %q", err)
|
||||
}
|
||||
|
||||
exp := "\nStep 1 : RUN env\n"
|
||||
if !strings.Contains(out, exp) {
|
||||
c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildBadCmdFlag(c *check.C) {
|
||||
name := "testbuildbadcmdflag"
|
||||
|
||||
_, out, err := buildImageWithOut(name, `
|
||||
FROM busybox
|
||||
MAINTAINER --boo joe@example.com`, false)
|
||||
if err == nil {
|
||||
c.Fatal("Build should have failed")
|
||||
}
|
||||
|
||||
exp := `"Unknown flag: boo"`
|
||||
if !strings.Contains(out, exp) {
|
||||
c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user