1
0
mirror of https://github.com/docker/cli.git synced 2026-01-13 18:22:35 +03:00

Move TestForbiddenContextPath to integration-cli

Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Upstream-commit: 686786f107582c27c69a6f40655c8fc52a8e4d00
Component: engine
This commit is contained in:
Alexandr Morozov
2014-06-17 10:26:42 +04:00
parent f81562b040
commit f7987f5c93
2 changed files with 25 additions and 48 deletions

View File

@@ -1170,3 +1170,28 @@ func TestBuildEntrypointRunCleanup(t *testing.T) {
}
logDone("build - cleanup cmd after RUN")
}
func TestBuldForbiddenContextPath(t *testing.T) {
name := "testbuildforbidpath"
defer deleteImages(name)
ctx, err := fakeContext(`FROM scratch
ADD ../../ test/
`,
map[string]string{
"test.txt": "test1",
"other.txt": "other",
})
defer ctx.Close()
if err != nil {
t.Fatal(err)
}
if _, err := buildImageFromContext(name, ctx, true); err != nil {
if !strings.Contains(err.Error(), "Forbidden path outside the build context: ../../ (/)") {
t.Fatal("Wrong error, must be about forbidden ../../ path")
}
} else {
t.Fatal("Error must not be nil")
}
logDone("build - forbidden context path")
}