From f88c2c04ef4dbae20eaddeaf69e605878f498041 Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Fri, 5 Jan 2018 03:17:17 +0000 Subject: [PATCH] busybox: Fix `ls` compatible issue BusyBox v1.26.2 (2017-03-09 00:04:38 UTC) supports `-le` option to get the full date and time information, while BusyBox v1.27.2 (2017-11-01 23:22:25 UTC, which is used by the official multi-arch image, uses `--full-time` instead of `-e` to get the same data. As a result, we will get below error for the `DockerSuite.TestBuildLastModified` test case in case of multi-arch image used: > docker_cli_build_test.go:446: > out2 = cli.DockerCmd(c, "run", name, "ls", "-le", "/file").Combined() > o/src/github.com/docker/docker/vendor/github.com/gotestyourself/gotestyourself/icmd/command.go:61: > t.Fatalf("at %s:%d - %s\n", filepath.Base(file), line, err.Error()) > ... Error: at cli.go:33 - > Command: /usr/local/bin/docker run testbuildlastmodified ls -le /file > ExitCode: 1 > Error: exit status 1 > Stdout: > Stderr: ls: invalid option -- e > BusyBox v1.27.2 (2017-11-01 23:22:25 UTC) multi-call binary. This PR tries to fix the above compatible issue for busybox image. Signed-off-by: Dennis Chen --- integration-cli/docker_cli_build_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 8ae5e05ed8..97024cf651 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -400,20 +400,27 @@ func (s *DockerSuite) TestBuildLastModified(c *check.C) { defer server.Close() var out, out2 string + var args []string + // Temopray workaround for #35963. Will remove this when that issue fixed + if runtime.GOARCH == "amd64" { + args = []string{"run", name, "ls", "-le", "/file"} + } else { + args = []string{"run", name, "ls", "-l", "--full-time", "/file"} + } dFmt := `FROM busybox ADD %s/file /` dockerfile := fmt.Sprintf(dFmt, server.URL()) cli.BuildCmd(c, name, build.WithoutCache, build.WithDockerfile(dockerfile)) - out = cli.DockerCmd(c, "run", name, "ls", "-le", "/file").Combined() + out = cli.DockerCmd(c, args...).Combined() // Build it again and make sure the mtime of the file didn't change. // Wait a few seconds to make sure the time changed enough to notice time.Sleep(2 * time.Second) cli.BuildCmd(c, name, build.WithoutCache, build.WithDockerfile(dockerfile)) - out2 = cli.DockerCmd(c, "run", name, "ls", "-le", "/file").Combined() + out2 = cli.DockerCmd(c, args...).Combined() if out != out2 { c.Fatalf("MTime changed:\nOrigin:%s\nNew:%s", out, out2) @@ -428,7 +435,7 @@ ADD %s/file /` dockerfile = fmt.Sprintf(dFmt, server.URL()) cli.BuildCmd(c, name, build.WithoutCache, build.WithDockerfile(dockerfile)) - out2 = cli.DockerCmd(c, "run", name, "ls", "-le", "/file").Combined() + out2 = cli.DockerCmd(c, args...).Combined() if out == out2 { c.Fatalf("MTime didn't change:\nOrigin:%s\nNew:%s", out, out2)