1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

Merge pull request #23093 from tkopczynski/20784-builder-dockerfile-outside-context

Builder integration tests for Dockerfile outside context as a unit test
This commit is contained in:
Vincent Demeester
2016-06-14 08:44:24 +02:00
committed by GitHub
3 changed files with 47 additions and 59 deletions

View File

@ -2988,32 +2988,6 @@ func (s *DockerSuite) TestBuildEntrypointRunCleanup(c *check.C) {
}
}
func (s *DockerSuite) TestBuildForbiddenContextPath(c *check.C) {
name := "testbuildforbidpath"
ctx, err := fakeContext(`FROM `+minimalBaseImage()+`
ADD ../../ test/
`,
map[string]string{
"test.txt": "test1",
"other.txt": "other",
})
if err != nil {
c.Fatal(err)
}
defer ctx.Close()
expected := "Forbidden path outside the build context: ../../ "
if daemonPlatform == "windows" {
expected = "Forbidden path outside the build context: ..\\..\\ "
}
if _, err := buildImageFromContext(name, ctx, true); err == nil || !strings.Contains(err.Error(), expected) {
c.Fatalf("Wrong error: (should contain \"%s\") got:\n%v", expected, err)
}
}
func (s *DockerSuite) TestBuildAddFileNotFound(c *check.C) {
name := "testbuildaddnotfound"
expected := "foo: no such file or directory"