Move TestForbiddenContextPath to integration-cli

Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
This commit is contained in:
Alexandr Morozov
2014-06-17 10:38:45 +04:00
parent c5b82f5e8d
commit 686786f107
2 changed files with 25 additions and 48 deletions
+25
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")
}