Signed-off-by: Tibor Vass <teabee89@gmail.com>
| ... | ... |
@@ -1317,7 +1317,7 @@ func TestBuildEntrypointRunCleanup(t *testing.T) {
|
| 1317 | 1317 |
logDone("build - cleanup cmd after RUN")
|
| 1318 | 1318 |
} |
| 1319 | 1319 |
|
| 1320 |
-func TestBuldForbiddenContextPath(t *testing.T) {
|
|
| 1320 |
+func TestBuildForbiddenContextPath(t *testing.T) {
|
|
| 1321 | 1321 |
name := "testbuildforbidpath" |
| 1322 | 1322 |
defer deleteImages(name) |
| 1323 | 1323 |
ctx, err := fakeContext(`FROM scratch |
| ... | ... |
@@ -1327,18 +1327,16 @@ func TestBuldForbiddenContextPath(t *testing.T) {
|
| 1327 | 1327 |
"test.txt": "test1", |
| 1328 | 1328 |
"other.txt": "other", |
| 1329 | 1329 |
}) |
| 1330 |
- |
|
| 1331 | 1330 |
defer ctx.Close() |
| 1332 | 1331 |
if err != nil {
|
| 1333 | 1332 |
t.Fatal(err) |
| 1334 | 1333 |
} |
| 1335 |
- if _, err := buildImageFromContext(name, ctx, true); err != nil {
|
|
| 1336 |
- if !strings.Contains(err.Error(), "Forbidden path outside the build context: ../../ (/)") {
|
|
| 1337 |
- t.Fatal("Wrong error, must be about forbidden ../../ path")
|
|
| 1338 |
- } |
|
| 1339 |
- } else {
|
|
| 1340 |
- t.Fatal("Error must not be nil")
|
|
| 1334 |
+ |
|
| 1335 |
+ expected := "Forbidden path outside the build context: ../../ " |
|
| 1336 |
+ if _, err := buildImageFromContext(name, ctx, true); err == nil || !strings.Contains(err.Error(), expected) {
|
|
| 1337 |
+ t.Fatalf("Wrong error: (should contain \"%s\") got:\n%v", expected, err)
|
|
| 1341 | 1338 |
} |
| 1339 |
+ |
|
| 1342 | 1340 |
logDone("build - forbidden context path")
|
| 1343 | 1341 |
} |
| 1344 | 1342 |
|