MCPcopy Index your code
hub / github.com/docker/cli / TestRunBuildWithSymlinkedContext

Function TestRunBuildWithSymlinkedContext

cli/command/image/build_test.go:153–173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

151}
152
153func TestRunBuildWithSymlinkedContext(t *testing.T) {
154 t.Setenv("DOCKER_BUILDKIT", "0")
155 dockerfile := `
156FROM alpine:frozen
157RUN echo hello world
158`
159
160 tmpDir := fs.NewDir(t, t.Name(),
161 fs.WithDir("context",
162 fs.WithFile("Dockerfile", dockerfile)),
163 fs.WithSymlink("context-link", "context"))
164 defer tmpDir.Remove()
165
166 fakeBuild := newFakeBuild()
167 cli := test.NewFakeCli(&fakeClient{imageBuildFunc: fakeBuild.build})
168 options := newBuildOptions()
169 options.context = tmpDir.Join("context-link")
170 assert.NilError(t, runBuild(context.TODO(), cli, options))
171
172 assert.DeepEqual(t, fakeBuild.filenames(t), []string{"Dockerfile"})
173}
174
175type fakeBuild struct {
176 context *tar.Reader

Callers

nothing calls this directly

Calls 6

newFakeBuildFunction · 0.85
newBuildOptionsFunction · 0.85
runBuildFunction · 0.85
filenamesMethod · 0.80
RemoveMethod · 0.65
NameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…