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

Function TestRunBuildFromLocalGitHubDir

cli/command/image/build_test.go:136–151  ·  view source on GitHub ↗

TestRunBuildFromLocalGitHubDir tests that a local directory starting with `github.com` takes precedence over the `github.com` special case.

(t *testing.T)

Source from the content-addressed store, hash-verified

134// starting with `github.com` takes precedence over the `github.com` special
135// case.
136func TestRunBuildFromLocalGitHubDir(t *testing.T) {
137 t.Setenv("DOCKER_BUILDKIT", "0")
138
139 buildDir := filepath.Join(t.TempDir(), "github.com", "docker", "no-such-repository")
140 err := os.MkdirAll(buildDir, 0o777)
141 assert.NilError(t, err)
142 err = os.WriteFile(filepath.Join(buildDir, "Dockerfile"), []byte("FROM busybox\n"), 0o644)
143 assert.NilError(t, err)
144
145 fakeCLI := test.NewFakeCli(&fakeClient{})
146 cmd := newBuildCommand(fakeCLI)
147 cmd.SetArgs([]string{buildDir})
148 cmd.SetOut(io.Discard)
149 err = cmd.Execute()
150 assert.NilError(t, err)
151}
152
153func TestRunBuildWithSymlinkedContext(t *testing.T) {
154 t.Setenv("DOCKER_BUILDKIT", "0")

Callers

nothing calls this directly

Calls 3

newBuildCommandFunction · 0.85
SetArgsMethod · 0.80
SetOutMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…