mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fifth set of TestBuild CI enables for Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
parent
14c63189a1
commit
0adcce10a1
1 changed files with 50 additions and 47 deletions
|
@ -3975,7 +3975,6 @@ RUN [ "$(cat /testfile)" = 'test!' ]`
|
||||||
func (s *DockerSuite) TestBuildAddTar(c *check.C) {
|
func (s *DockerSuite) TestBuildAddTar(c *check.C) {
|
||||||
// /test/foo is not owned by the correct user
|
// /test/foo is not owned by the correct user
|
||||||
testRequires(c, NotUserNamespace)
|
testRequires(c, NotUserNamespace)
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildaddtar"
|
name := "testbuildaddtar"
|
||||||
|
|
||||||
ctx := func() *FakeContext {
|
ctx := func() *FakeContext {
|
||||||
|
@ -3989,7 +3988,7 @@ ADD test.tar /unlikely-to-exist
|
||||||
RUN cat /unlikely-to-exist/test/foo | grep Hi
|
RUN cat /unlikely-to-exist/test/foo | grep Hi
|
||||||
ADD test.tar /unlikely-to-exist-trailing-slash/
|
ADD test.tar /unlikely-to-exist-trailing-slash/
|
||||||
RUN cat /unlikely-to-exist-trailing-slash/test/foo | grep Hi
|
RUN cat /unlikely-to-exist-trailing-slash/test/foo | grep Hi
|
||||||
RUN mkdir /existing-directory
|
RUN sh -c "mkdir /existing-directory" #sh -c is needed on Windows to use the correct mkdir
|
||||||
ADD test.tar /existing-directory
|
ADD test.tar /existing-directory
|
||||||
RUN cat /existing-directory/test/foo | grep Hi
|
RUN cat /existing-directory/test/foo | grep Hi
|
||||||
ADD test.tar /existing-directory-trailing-slash/
|
ADD test.tar /existing-directory-trailing-slash/
|
||||||
|
@ -4031,7 +4030,6 @@ RUN cat /existing-directory-trailing-slash/test/foo | grep Hi`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildAddBrokenTar(c *check.C) {
|
func (s *DockerSuite) TestBuildAddBrokenTar(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildaddbrokentar"
|
name := "testbuildaddbrokentar"
|
||||||
|
|
||||||
ctx := func() *FakeContext {
|
ctx := func() *FakeContext {
|
||||||
|
@ -4083,7 +4081,6 @@ ADD test.tar /`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildAddNonTar(c *check.C) {
|
func (s *DockerSuite) TestBuildAddNonTar(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildaddnontar"
|
name := "testbuildaddnontar"
|
||||||
|
|
||||||
// Should not try to extract test.tar
|
// Should not try to extract test.tar
|
||||||
|
@ -4219,7 +4216,6 @@ func (s *DockerSuite) TestBuildAddTarXzGz(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildFromGIT(c *check.C) {
|
func (s *DockerSuite) TestBuildFromGIT(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildfromgit"
|
name := "testbuildfromgit"
|
||||||
git, err := newFakeGit("repo", map[string]string{
|
git, err := newFakeGit("repo", map[string]string{
|
||||||
"Dockerfile": `FROM busybox
|
"Dockerfile": `FROM busybox
|
||||||
|
@ -4244,7 +4240,6 @@ func (s *DockerSuite) TestBuildFromGIT(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildFromGITWithContext(c *check.C) {
|
func (s *DockerSuite) TestBuildFromGITWithContext(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildfromgit"
|
name := "testbuildfromgit"
|
||||||
git, err := newFakeGit("repo", map[string]string{
|
git, err := newFakeGit("repo", map[string]string{
|
||||||
"docker/Dockerfile": `FROM busybox
|
"docker/Dockerfile": `FROM busybox
|
||||||
|
@ -4270,7 +4265,6 @@ func (s *DockerSuite) TestBuildFromGITWithContext(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildFromGITwithF(c *check.C) {
|
func (s *DockerSuite) TestBuildFromGITwithF(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildfromgitwithf"
|
name := "testbuildfromgitwithf"
|
||||||
git, err := newFakeGit("repo", map[string]string{
|
git, err := newFakeGit("repo", map[string]string{
|
||||||
"myApp/myDockerfile": `FROM busybox
|
"myApp/myDockerfile": `FROM busybox
|
||||||
|
@ -4332,10 +4326,9 @@ func (s *DockerSuite) TestBuildFromRemoteTarball(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildCleanupCmdOnEntrypoint(c *check.C) {
|
func (s *DockerSuite) TestBuildCleanupCmdOnEntrypoint(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildcmdcleanuponentrypoint"
|
name := "testbuildcmdcleanuponentrypoint"
|
||||||
if _, err := buildImage(name,
|
if _, err := buildImage(name,
|
||||||
`FROM scratch
|
`FROM `+minimalBaseImage()+`
|
||||||
CMD ["test"]
|
CMD ["test"]
|
||||||
ENTRYPOINT ["echo"]`,
|
ENTRYPOINT ["echo"]`,
|
||||||
true); err != nil {
|
true); err != nil {
|
||||||
|
@ -4359,10 +4352,9 @@ func (s *DockerSuite) TestBuildCleanupCmdOnEntrypoint(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildClearCmd(c *check.C) {
|
func (s *DockerSuite) TestBuildClearCmd(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildclearcmd"
|
name := "testbuildclearcmd"
|
||||||
_, err := buildImage(name,
|
_, err := buildImage(name,
|
||||||
`From scratch
|
`From `+minimalBaseImage()+`
|
||||||
ENTRYPOINT ["/bin/bash"]
|
ENTRYPOINT ["/bin/bash"]
|
||||||
CMD []`,
|
CMD []`,
|
||||||
true)
|
true)
|
||||||
|
@ -4376,9 +4368,8 @@ func (s *DockerSuite) TestBuildClearCmd(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildEmptyCmd(c *check.C) {
|
func (s *DockerSuite) TestBuildEmptyCmd(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildemptycmd"
|
name := "testbuildemptycmd"
|
||||||
if _, err := buildImage(name, "FROM scratch\nMAINTAINER quux\n", true); err != nil {
|
if _, err := buildImage(name, "FROM "+minimalBaseImage()+"\nMAINTAINER quux\n", true); err != nil {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
res := inspectFieldJSON(c, name, "Config.Cmd")
|
res := inspectFieldJSON(c, name, "Config.Cmd")
|
||||||
|
@ -4388,7 +4379,6 @@ func (s *DockerSuite) TestBuildEmptyCmd(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildOnBuildOutput(c *check.C) {
|
func (s *DockerSuite) TestBuildOnBuildOutput(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildonbuildparent"
|
name := "testbuildonbuildparent"
|
||||||
if _, err := buildImage(name, "FROM busybox\nONBUILD RUN echo foo\n", true); err != nil {
|
if _, err := buildImage(name, "FROM busybox\nONBUILD RUN echo foo\n", true); err != nil {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
|
@ -4405,9 +4395,8 @@ func (s *DockerSuite) TestBuildOnBuildOutput(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildInvalidTag(c *check.C) {
|
func (s *DockerSuite) TestBuildInvalidTag(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "abcd:" + stringutils.GenerateRandomAlphaOnlyString(200)
|
name := "abcd:" + stringutils.GenerateRandomAlphaOnlyString(200)
|
||||||
_, out, err := buildImageWithOut(name, "FROM scratch\nMAINTAINER quux\n", true)
|
_, out, err := buildImageWithOut(name, "FROM "+minimalBaseImage()+"\nMAINTAINER quux\n", true)
|
||||||
// if the error doesn't check for illegal tag name, or the image is built
|
// if the error doesn't check for illegal tag name, or the image is built
|
||||||
// then this should fail
|
// then this should fail
|
||||||
if !strings.Contains(out, "Error parsing reference") || strings.Contains(out, "Sending build context to Docker daemon") {
|
if !strings.Contains(out, "Error parsing reference") || strings.Contains(out, "Sending build context to Docker daemon") {
|
||||||
|
@ -4416,7 +4405,6 @@ func (s *DockerSuite) TestBuildInvalidTag(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildCmdShDashC(c *check.C) {
|
func (s *DockerSuite) TestBuildCmdShDashC(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildcmdshc"
|
name := "testbuildcmdshc"
|
||||||
if _, err := buildImage(name, "FROM busybox\nCMD echo cmd\n", true); err != nil {
|
if _, err := buildImage(name, "FROM busybox\nCMD echo cmd\n", true); err != nil {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
|
@ -4425,6 +4413,9 @@ func (s *DockerSuite) TestBuildCmdShDashC(c *check.C) {
|
||||||
res := inspectFieldJSON(c, name, "Config.Cmd")
|
res := inspectFieldJSON(c, name, "Config.Cmd")
|
||||||
|
|
||||||
expected := `["/bin/sh","-c","echo cmd"]`
|
expected := `["/bin/sh","-c","echo cmd"]`
|
||||||
|
if daemonPlatform == "windows" {
|
||||||
|
expected = `["cmd","/S","/C","echo cmd"]`
|
||||||
|
}
|
||||||
|
|
||||||
if res != expected {
|
if res != expected {
|
||||||
c.Fatalf("Expected value %s not in Config.Cmd: %s", expected, res)
|
c.Fatalf("Expected value %s not in Config.Cmd: %s", expected, res)
|
||||||
|
@ -4433,7 +4424,6 @@ func (s *DockerSuite) TestBuildCmdShDashC(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildCmdSpaces(c *check.C) {
|
func (s *DockerSuite) TestBuildCmdSpaces(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
// Test to make sure that when we strcat arrays we take into account
|
// Test to make sure that when we strcat arrays we take into account
|
||||||
// the arg separator to make sure ["echo","hi"] and ["echo hi"] don't
|
// the arg separator to make sure ["echo","hi"] and ["echo hi"] don't
|
||||||
// look the same
|
// look the same
|
||||||
|
@ -4470,7 +4460,6 @@ func (s *DockerSuite) TestBuildCmdSpaces(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildCmdJSONNoShDashC(c *check.C) {
|
func (s *DockerSuite) TestBuildCmdJSONNoShDashC(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildcmdjson"
|
name := "testbuildcmdjson"
|
||||||
if _, err := buildImage(name, "FROM busybox\nCMD [\"echo\", \"cmd\"]", true); err != nil {
|
if _, err := buildImage(name, "FROM busybox\nCMD [\"echo\", \"cmd\"]", true); err != nil {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
|
@ -4487,7 +4476,6 @@ func (s *DockerSuite) TestBuildCmdJSONNoShDashC(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildErrorInvalidInstruction(c *check.C) {
|
func (s *DockerSuite) TestBuildErrorInvalidInstruction(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildignoreinvalidinstruction"
|
name := "testbuildignoreinvalidinstruction"
|
||||||
|
|
||||||
out, _, err := buildImageWithOut(name, "FROM busybox\nfoo bar", true)
|
out, _, err := buildImageWithOut(name, "FROM busybox\nfoo bar", true)
|
||||||
|
@ -4498,7 +4486,6 @@ func (s *DockerSuite) TestBuildErrorInvalidInstruction(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildEntrypointInheritance(c *check.C) {
|
func (s *DockerSuite) TestBuildEntrypointInheritance(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
|
|
||||||
if _, err := buildImage("parent", `
|
if _, err := buildImage("parent", `
|
||||||
FROM busybox
|
FROM busybox
|
||||||
|
@ -4525,13 +4512,16 @@ func (s *DockerSuite) TestBuildEntrypointInheritance(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildEntrypointInheritanceInspect(c *check.C) {
|
func (s *DockerSuite) TestBuildEntrypointInheritanceInspect(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
var (
|
var (
|
||||||
name = "testbuildepinherit"
|
name = "testbuildepinherit"
|
||||||
name2 = "testbuildepinherit2"
|
name2 = "testbuildepinherit2"
|
||||||
expected = `["/bin/sh","-c","echo quux"]`
|
expected = `["/bin/sh","-c","echo quux"]`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if daemonPlatform == "windows" {
|
||||||
|
expected = `["cmd","/S","/C","echo quux"]`
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := buildImage(name, "FROM busybox\nENTRYPOINT /foo/bar", true); err != nil {
|
if _, err := buildImage(name, "FROM busybox\nENTRYPOINT /foo/bar", true); err != nil {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -4546,7 +4536,7 @@ func (s *DockerSuite) TestBuildEntrypointInheritanceInspect(c *check.C) {
|
||||||
c.Fatalf("Expected value %s not in Config.Entrypoint: %s", expected, res)
|
c.Fatalf("Expected value %s not in Config.Entrypoint: %s", expected, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "run", "-t", name2)
|
out, _ := dockerCmd(c, "run", name2)
|
||||||
|
|
||||||
expected = "quux"
|
expected = "quux"
|
||||||
|
|
||||||
|
@ -4557,11 +4547,10 @@ func (s *DockerSuite) TestBuildEntrypointInheritanceInspect(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildRunShEntrypoint(c *check.C) {
|
func (s *DockerSuite) TestBuildRunShEntrypoint(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildentrypoint"
|
name := "testbuildentrypoint"
|
||||||
_, err := buildImage(name,
|
_, err := buildImage(name,
|
||||||
`FROM busybox
|
`FROM busybox
|
||||||
ENTRYPOINT /bin/echo`,
|
ENTRYPOINT echo`,
|
||||||
true)
|
true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
|
@ -4600,7 +4589,6 @@ func (s *DockerSuite) TestBuildExoticShellInterpolation(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *check.C) {
|
func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
// This testcase is supposed to generate an error because the
|
// This testcase is supposed to generate an error because the
|
||||||
// JSON array we're passing in on the CMD uses single quotes instead
|
// JSON array we're passing in on the CMD uses single quotes instead
|
||||||
// of double quotes (per the JSON spec). This means we interpret it
|
// of double quotes (per the JSON spec). This means we interpret it
|
||||||
|
@ -4622,8 +4610,12 @@ func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildVerboseOut(c *check.C) {
|
func (s *DockerSuite) TestBuildVerboseOut(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildverboseout"
|
name := "testbuildverboseout"
|
||||||
|
expected := "\n123\n"
|
||||||
|
|
||||||
|
if daemonPlatform == "windows" {
|
||||||
|
expected = "\n123\r\n"
|
||||||
|
}
|
||||||
|
|
||||||
_, out, err := buildImageWithOut(name,
|
_, out, err := buildImageWithOut(name,
|
||||||
`FROM busybox
|
`FROM busybox
|
||||||
|
@ -4633,14 +4625,13 @@ RUN echo 123`,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
if !strings.Contains(out, "\n123\n") {
|
if !strings.Contains(out, expected) {
|
||||||
c.Fatalf("Output should contain %q: %q", "123", out)
|
c.Fatalf("Output should contain %q: %q", "123", out)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildWithTabs(c *check.C) {
|
func (s *DockerSuite) TestBuildWithTabs(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildwithtabs"
|
name := "testbuildwithtabs"
|
||||||
_, err := buildImage(name,
|
_, err := buildImage(name,
|
||||||
"FROM busybox\nRUN echo\tone\t\ttwo", true)
|
"FROM busybox\nRUN echo\tone\t\ttwo", true)
|
||||||
|
@ -4650,13 +4641,16 @@ func (s *DockerSuite) TestBuildWithTabs(c *check.C) {
|
||||||
res := inspectFieldJSON(c, name, "ContainerConfig.Cmd")
|
res := inspectFieldJSON(c, name, "ContainerConfig.Cmd")
|
||||||
expected1 := `["/bin/sh","-c","echo\tone\t\ttwo"]`
|
expected1 := `["/bin/sh","-c","echo\tone\t\ttwo"]`
|
||||||
expected2 := `["/bin/sh","-c","echo\u0009one\u0009\u0009two"]` // syntactically equivalent, and what Go 1.3 generates
|
expected2 := `["/bin/sh","-c","echo\u0009one\u0009\u0009two"]` // syntactically equivalent, and what Go 1.3 generates
|
||||||
|
if daemonPlatform == "windows" {
|
||||||
|
expected1 = `["cmd","/S","/C","echo\tone\t\ttwo"]`
|
||||||
|
expected2 = `["cmd","/S","/C","echo\u0009one\u0009\u0009two"]` // syntactically equivalent, and what Go 1.3 generates
|
||||||
|
}
|
||||||
if res != expected1 && res != expected2 {
|
if res != expected1 && res != expected2 {
|
||||||
c.Fatalf("Missing tabs.\nGot: %s\nExp: %s or %s", res, expected1, expected2)
|
c.Fatalf("Missing tabs.\nGot: %s\nExp: %s or %s", res, expected1, expected2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildLabels(c *check.C) {
|
func (s *DockerSuite) TestBuildLabels(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildlabel"
|
name := "testbuildlabel"
|
||||||
expected := `{"License":"GPL","Vendor":"Acme"}`
|
expected := `{"License":"GPL","Vendor":"Acme"}`
|
||||||
_, err := buildImage(name,
|
_, err := buildImage(name,
|
||||||
|
@ -4674,7 +4668,6 @@ func (s *DockerSuite) TestBuildLabels(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildLabelsCache(c *check.C) {
|
func (s *DockerSuite) TestBuildLabelsCache(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildlabelcache"
|
name := "testbuildlabelcache"
|
||||||
|
|
||||||
id1, err := buildImage(name,
|
id1, err := buildImage(name,
|
||||||
|
@ -4723,7 +4716,6 @@ func (s *DockerSuite) TestBuildLabelsCache(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildNotVerboseSuccess(c *check.C) {
|
func (s *DockerSuite) TestBuildNotVerboseSuccess(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
// This test makes sure that -q works correctly when build is successful:
|
// This test makes sure that -q works correctly when build is successful:
|
||||||
// stdout has only the image ID (long image ID) and stderr is empty.
|
// stdout has only the image ID (long image ID) and stderr is empty.
|
||||||
var stdout, stderr string
|
var stdout, stderr string
|
||||||
|
@ -4803,7 +4795,6 @@ func (s *DockerSuite) TestBuildNotVerboseSuccess(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildNotVerboseFailure(c *check.C) {
|
func (s *DockerSuite) TestBuildNotVerboseFailure(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
// This test makes sure that -q works correctly when build fails by
|
// This test makes sure that -q works correctly when build fails by
|
||||||
// comparing between the stderr output in quiet mode and in stdout
|
// comparing between the stderr output in quiet mode and in stdout
|
||||||
// and stderr output in verbose mode
|
// and stderr output in verbose mode
|
||||||
|
@ -4829,7 +4820,6 @@ func (s *DockerSuite) TestBuildNotVerboseFailure(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildNotVerboseFailureRemote(c *check.C) {
|
func (s *DockerSuite) TestBuildNotVerboseFailureRemote(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
// This test ensures that when given a wrong URL, stderr in quiet mode and
|
// This test ensures that when given a wrong URL, stderr in quiet mode and
|
||||||
// stdout and stderr in verbose mode are identical.
|
// stdout and stderr in verbose mode are identical.
|
||||||
URL := "http://bla.bla.com"
|
URL := "http://bla.bla.com"
|
||||||
|
@ -4845,7 +4835,6 @@ func (s *DockerSuite) TestBuildNotVerboseFailureRemote(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildStderr(c *check.C) {
|
func (s *DockerSuite) TestBuildStderr(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
// This test just makes sure that no non-error output goes
|
// This test just makes sure that no non-error output goes
|
||||||
// to stderr
|
// to stderr
|
||||||
name := "testbuildstderr"
|
name := "testbuildstderr"
|
||||||
|
@ -4900,7 +4889,6 @@ RUN [ $(ls -l /test | awk '{print $3":"$4}') = 'root:root' ]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildSymlinkBreakout(c *check.C) {
|
func (s *DockerSuite) TestBuildSymlinkBreakout(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildsymlinkbreakout"
|
name := "testbuildsymlinkbreakout"
|
||||||
tmpdir, err := ioutil.TempDir("", name)
|
tmpdir, err := ioutil.TempDir("", name)
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
|
@ -4984,15 +4972,21 @@ RUN [ ! -e /injected ]`,
|
||||||
func (s *DockerSuite) TestBuildVolumesRetainContents(c *check.C) {
|
func (s *DockerSuite) TestBuildVolumesRetainContents(c *check.C) {
|
||||||
// /foo/file gets permission denied for the user
|
// /foo/file gets permission denied for the user
|
||||||
testRequires(c, NotUserNamespace)
|
testRequires(c, NotUserNamespace)
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux) // TODO Windows: Issue #20127
|
||||||
var (
|
var (
|
||||||
name = "testbuildvolumescontent"
|
name = "testbuildvolumescontent"
|
||||||
expected = "some text"
|
expected = "some text"
|
||||||
|
volName = "/foo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if daemonPlatform == "windows" {
|
||||||
|
volName = "C:/foo"
|
||||||
|
}
|
||||||
|
|
||||||
ctx, err := fakeContext(`
|
ctx, err := fakeContext(`
|
||||||
FROM busybox
|
FROM busybox
|
||||||
COPY content /foo/file
|
COPY content /foo/file
|
||||||
VOLUME /foo
|
VOLUME `+volName+`
|
||||||
CMD cat /foo/file`,
|
CMD cat /foo/file`,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
"content": expected,
|
"content": expected,
|
||||||
|
@ -5014,7 +5008,6 @@ CMD cat /foo/file`,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildRenamedDockerfile(c *check.C) {
|
func (s *DockerSuite) TestBuildRenamedDockerfile(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
|
|
||||||
ctx, err := fakeContext(`FROM busybox
|
ctx, err := fakeContext(`FROM busybox
|
||||||
RUN echo from Dockerfile`,
|
RUN echo from Dockerfile`,
|
||||||
|
@ -5204,9 +5197,9 @@ RUN echo from Dockerfile`,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildFromStdinWithF(c *check.C) {
|
func (s *DockerSuite) TestBuildFromStdinWithF(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux) // TODO Windows: This test is flaky; no idea why
|
||||||
ctx, err := fakeContext(`FROM busybox
|
ctx, err := fakeContext(`FROM busybox
|
||||||
RUN echo from Dockerfile`,
|
RUN echo "from Dockerfile"`,
|
||||||
map[string]string{})
|
map[string]string{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
|
@ -5218,9 +5211,9 @@ RUN echo from Dockerfile`,
|
||||||
dockerCommand := exec.Command(dockerBinary, "build", "-f", "baz", "-t", "test1", "-")
|
dockerCommand := exec.Command(dockerBinary, "build", "-f", "baz", "-t", "test1", "-")
|
||||||
dockerCommand.Dir = ctx.Dir
|
dockerCommand.Dir = ctx.Dir
|
||||||
dockerCommand.Stdin = strings.NewReader(`FROM busybox
|
dockerCommand.Stdin = strings.NewReader(`FROM busybox
|
||||||
RUN echo from baz
|
RUN echo "from baz"
|
||||||
COPY * /tmp/
|
COPY * /tmp/
|
||||||
RUN find /tmp/`)
|
RUN sh -c "find /tmp/" # sh -c is needed on Windows to use the correct find`)
|
||||||
out, status, err := runCommandWithOutput(dockerCommand)
|
out, status, err := runCommandWithOutput(dockerCommand)
|
||||||
if err != nil || status != 0 {
|
if err != nil || status != 0 {
|
||||||
c.Fatalf("Error building: %s", err)
|
c.Fatalf("Error building: %s", err)
|
||||||
|
@ -5235,7 +5228,6 @@ RUN find /tmp/`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildFromOfficialNames(c *check.C) {
|
func (s *DockerSuite) TestBuildFromOfficialNames(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
name := "testbuildfromofficial"
|
name := "testbuildfromofficial"
|
||||||
fromNames := []string{
|
fromNames := []string{
|
||||||
"busybox",
|
"busybox",
|
||||||
|
@ -5314,7 +5306,6 @@ func (s *DockerSuite) TestBuildDockerfileOutsideContext(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildSpaces(c *check.C) {
|
func (s *DockerSuite) TestBuildSpaces(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
// Test to make sure that leading/trailing spaces on a command
|
// Test to make sure that leading/trailing spaces on a command
|
||||||
// doesn't change the error msg we get
|
// doesn't change the error msg we get
|
||||||
var (
|
var (
|
||||||
|
@ -5407,7 +5398,7 @@ RUN echo " \
|
||||||
|
|
||||||
// #4393
|
// #4393
|
||||||
func (s *DockerSuite) TestBuildVolumeFileExistsinContainer(c *check.C) {
|
func (s *DockerSuite) TestBuildVolumeFileExistsinContainer(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux) // TODO Windows: This should error out
|
||||||
buildCmd := exec.Command(dockerBinary, "build", "-t", "docker-test-errcreatevolumewithfile", "-")
|
buildCmd := exec.Command(dockerBinary, "build", "-t", "docker-test-errcreatevolumewithfile", "-")
|
||||||
buildCmd.Stdin = strings.NewReader(`
|
buildCmd.Stdin = strings.NewReader(`
|
||||||
FROM busybox
|
FROM busybox
|
||||||
|
@ -5423,7 +5414,6 @@ func (s *DockerSuite) TestBuildVolumeFileExistsinContainer(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildMissingArgs(c *check.C) {
|
func (s *DockerSuite) TestBuildMissingArgs(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
// Test to make sure that all Dockerfile commands (except the ones listed
|
// Test to make sure that all Dockerfile commands (except the ones listed
|
||||||
// in skipCmds) will generate an error if no args are provided.
|
// in skipCmds) will generate an error if no args are provided.
|
||||||
// Note: INSERT is deprecated so we exclude it because of that.
|
// Note: INSERT is deprecated so we exclude it because of that.
|
||||||
|
@ -5434,6 +5424,19 @@ func (s *DockerSuite) TestBuildMissingArgs(c *check.C) {
|
||||||
"INSERT": {},
|
"INSERT": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if daemonPlatform == "windows" {
|
||||||
|
skipCmds = map[string]struct{}{
|
||||||
|
"CMD": {},
|
||||||
|
"RUN": {},
|
||||||
|
"ENTRYPOINT": {},
|
||||||
|
"INSERT": {},
|
||||||
|
"STOPSIGNAL": {},
|
||||||
|
"ARG": {},
|
||||||
|
"USER": {},
|
||||||
|
"EXPOSE": {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for cmd := range command.Commands {
|
for cmd := range command.Commands {
|
||||||
cmd = strings.ToUpper(cmd)
|
cmd = strings.ToUpper(cmd)
|
||||||
if _, ok := skipCmds[cmd]; ok {
|
if _, ok := skipCmds[cmd]; ok {
|
||||||
|
|
Loading…
Reference in a new issue