Merge pull request #12999 from duglin/BadRUNerrMsg

Fix RUN's error msg when it fails
This commit is contained in:
Brian Goff
2015-05-06 15:49:24 -04:00
3 changed files with 23 additions and 1 deletions
+17
View File
@@ -5384,3 +5384,20 @@ func (s *DockerSuite) TestBuildBadCmdFlag(c *check.C) {
c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
}
}
func (s *DockerSuite) TestBuildRUNErrMsg(c *check.C) {
// Test to make sure the bad command is quoted with just "s and
// not as a Go []string
name := "testbuildbadrunerrmsg"
_, out, err := buildImageWithOut(name, `
FROM busybox
RUN badEXE a1 a2`, false)
if err == nil {
c.Fatal("Should have failed to build")
}
exp := `The command \"/bin/sh -c badEXE a1 a2\" returned a non-zero code: 127"`
if !strings.Contains(out, exp) {
c.Fatalf("RUN doesn't have the correct output:\nGot:%s\nExpected:%s", out, exp)
}
}