1
0
mirror of https://github.com/moby/moby.git synced 2025-08-01 05:47:11 +03:00

Move FakeContext to integration-cli/cli/build/context package…

… and continue emptying `docker_utils_test.go` from build related function.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester
2017-04-10 14:42:21 +02:00
parent a258ef58d8
commit 56fb4653e8
13 changed files with 1011 additions and 935 deletions

View File

@ -10,7 +10,9 @@ import (
"time"
"github.com/docker/docker/integration-cli/checker"
"github.com/docker/docker/integration-cli/cli"
"github.com/docker/docker/integration-cli/cli/build"
"github.com/docker/docker/integration-cli/cli/build/fakecontext"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/testutil"
icmd "github.com/docker/docker/pkg/testutil/cmd"
@ -438,19 +440,21 @@ RUN chmod 755 /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD echo foobar`
ctx := fakeContext(c, dockerfile, map[string]string{
"entrypoint.sh": `#!/bin/sh
ctx := fakecontext.New(c, "",
fakecontext.WithDockerfile(dockerfile),
fakecontext.WithFiles(map[string]string{
"entrypoint.sh": `#!/bin/sh
echo "I am an entrypoint"
exec "$@"`,
})
}))
defer ctx.Close()
buildImageSuccessfully(c, name, withExternalBuildContext(ctx))
cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
out, _ := dockerCmd(c, "create", "--entrypoint=", name, "echo", "foo")
out := cli.DockerCmd(c, "create", "--entrypoint=", name, "echo", "foo").Combined()
id := strings.TrimSpace(out)
c.Assert(id, check.Not(check.Equals), "")
out, _ = dockerCmd(c, "start", "-a", id)
out = cli.DockerCmd(c, "start", "-a", id).Combined()
c.Assert(strings.TrimSpace(out), check.Equals, "foo")
}