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:
@ -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"
|
||||
|
Reference in New Issue
Block a user