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 <dennis.chen@arm.com>
This commit is contained in:
parent
662bdb4a56
commit
f88c2c04ef
1 changed files with 10 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue