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

Reimplementing builder tests for Dockerfile outside context as a unit test

Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
This commit is contained in:
Tomasz Kopczynski
2016-05-29 18:56:49 +02:00
parent 6184518fe3
commit fb175bb367
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"