Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
| ... | ... |
@@ -827,14 +827,14 @@ COPY . /`, |
| 827 | 827 |
} |
| 828 | 828 |
|
| 829 | 829 |
func TestBuildCopyDisallowRemote(t *testing.T) {
|
| 830 |
- buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") |
|
| 831 |
- buildCmd := exec.Command(dockerBinary, "build", "-t", "testcopyimg", "DisallowRemote") |
|
| 832 |
- buildCmd.Dir = buildDirectory |
|
| 833 |
- if out, _, err := runCommandWithOutput(buildCmd); err == nil {
|
|
| 834 |
- t.Fatalf("building the image should've failed; output: %s", out)
|
|
| 830 |
+ name := "testcopydisallowremote" |
|
| 831 |
+ defer deleteImages(name) |
|
| 832 |
+ _, out, err := buildImageWithOut(name, `FROM scratch |
|
| 833 |
+COPY https://index.docker.io/robots.txt /`, |
|
| 834 |
+ true) |
|
| 835 |
+ if err == nil || !strings.Contains(out, "Source can't be a URL for COPY") {
|
|
| 836 |
+ t.Fatal("Error should be about disallowed remote source, got err: %s, out: %q", err, out)
|
|
| 835 | 837 |
} |
| 836 |
- |
|
| 837 |
- deleteImages("testcopyimg")
|
|
| 838 | 838 |
logDone("build - copy - disallow copy from remote")
|
| 839 | 839 |
} |
| 840 | 840 |
|