mirror of https://github.com/docker/docs.git
Fix TestBuildForbiddenContextPath after TMPDIR change
Signed-off-by: Tibor Vass <teabee89@gmail.com>
This commit is contained in:
parent
66c8f87e89
commit
5e20b0027c
|
@ -1317,7 +1317,7 @@ func TestBuildEntrypointRunCleanup(t *testing.T) {
|
|||
logDone("build - cleanup cmd after RUN")
|
||||
}
|
||||
|
||||
func TestBuldForbiddenContextPath(t *testing.T) {
|
||||
func TestBuildForbiddenContextPath(t *testing.T) {
|
||||
name := "testbuildforbidpath"
|
||||
defer deleteImages(name)
|
||||
ctx, err := fakeContext(`FROM scratch
|
||||
|
@ -1327,18 +1327,16 @@ func TestBuldForbiddenContextPath(t *testing.T) {
|
|||
"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")
|
||||
|
||||
expected := "Forbidden path outside the build context: ../../ "
|
||||
if _, err := buildImageFromContext(name, ctx, true); err == nil || !strings.Contains(err.Error(), expected) {
|
||||
t.Fatalf("Wrong error: (should contain \"%s\") got:\n%v", expected, err)
|
||||
}
|
||||
|
||||
logDone("build - forbidden context path")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue