(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func TestRunBuildDockerfileOutsideContext(t *testing.T) { |
| 90 | t.Setenv("DOCKER_BUILDKIT", "0") |
| 91 | dir := fs.NewDir(t, t.Name(), |
| 92 | fs.WithFile("data", "data file")) |
| 93 | defer dir.Remove() |
| 94 | |
| 95 | // Dockerfile outside of build-context |
| 96 | df := fs.NewFile(t, t.Name(), |
| 97 | fs.WithContent(` |
| 98 | FROM FOOBAR |
| 99 | COPY data /data |
| 100 | `), |
| 101 | ) |
| 102 | defer df.Remove() |
| 103 | |
| 104 | fakeBuild := newFakeBuild() |
| 105 | cli := test.NewFakeCli(&fakeClient{imageBuildFunc: fakeBuild.build}) |
| 106 | |
| 107 | options := newBuildOptions() |
| 108 | options.context = dir.Path() |
| 109 | options.dockerfileName = df.Path() |
| 110 | assert.NilError(t, runBuild(context.TODO(), cli, options)) |
| 111 | |
| 112 | expected := []string{fakeBuild.options.Dockerfile, ".dockerignore", "data"} |
| 113 | assert.DeepEqual(t, expected, fakeBuild.filenames(t)) |
| 114 | } |
| 115 | |
| 116 | // TestRunBuildFromGitHubSpecialCase tests that build contexts |
| 117 | // starting with `github.com/` are special-cased, and the build command attempts |
nothing calls this directly
no test coverage detected
searching dependent graphs…