Skip to content

Instantly share code, notes, and snippets.

@tiborvass
Created February 3, 2015 15:24
Show Gist options
  • Save tiborvass/8cfec4a2500195e94fad to your computer and use it in GitHub Desktop.
Save tiborvass/8cfec4a2500195e94fad to your computer and use it in GitHub Desktop.
diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go
index fad3831..80cf499 100644
--- a/integration-cli/docker_cli_build_test.go
+++ b/integration-cli/docker_cli_build_test.go
@@ -4642,7 +4642,7 @@ func TestBuildDockerfileOutsideContext(t *testing.T) {
if err := os.MkdirAll(ctx, 0755); err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(filepath.Join(ctx, "Dockerfile"), []byte("FROM busybox"), 0644); err != nil {
+ if err := ioutil.WriteFile(filepath.Join(ctx, "Dockerfile"), []byte("FROM scratch\nENV X Y"), 0644); err != nil {
t.Fatal(err)
}
wd, err := os.Getwd()
@@ -4653,7 +4653,7 @@ func TestBuildDockerfileOutsideContext(t *testing.T) {
if err := os.Chdir(ctx); err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(filepath.Join(tmpdir, "outsideDockerfile"), []byte("FROM busbox"), 0644); err != nil {
+ if err := ioutil.WriteFile(filepath.Join(tmpdir, "outsideDockerfile"), []byte("FROM scratch\nENV x y"), 0644); err != nil {
t.Fatal(err)
}
if err := os.Symlink("../outsideDockerfile", filepath.Join(ctx, "dockerfile1")); err != nil {
@@ -4662,23 +4662,18 @@ func TestBuildDockerfileOutsideContext(t *testing.T) {
if err := os.Symlink(filepath.Join(tmpdir, "outsideDockerfile"), filepath.Join(ctx, "dockerfile2")); err != nil {
t.Fatal(err)
}
- if err := os.Link("../outsideDockerfile", filepath.Join(ctx, "dockerfile3")); err != nil {
- t.Fatal(err)
- }
- if err := os.Link(filepath.Join(tmpdir, "outsideDockerfile"), filepath.Join(ctx, "dockerfile4")); err != nil {
- t.Fatal(err)
- }
for _, dockerfilePath := range []string{
"../outsideDockerfile",
filepath.Join(ctx, "dockerfile1"),
filepath.Join(ctx, "dockerfile2"),
- filepath.Join(ctx, "dockerfile3"),
- filepath.Join(ctx, "dockerfile4"),
} {
out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "build", "-t", name, "--no-cache", "-f", dockerfilePath, "."))
if err == nil {
t.Fatalf("Expected error with %s. Out: %s", dockerfilePath, out)
}
+ if !strings.Contains(out, "must be within the build context") && !strings.Contains(out, "Cannot locate Dockerfile") {
+ t.Fatalf("Unexpected error with %s. Out: %s", dockerfilePath, out)
+ }
deleteImages(name)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment