1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Rewrite TestBuildCopyDisallowRemote to not use fixtures

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
This commit is contained in:
Alexandr Morozov 2014-10-14 10:37:05 -07:00
parent c8a5d56fd7
commit 98e7608b4c
2 changed files with 7 additions and 9 deletions

View file

@ -1,2 +0,0 @@
FROM busybox
COPY https://index.docker.io/robots.txt /

View file

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