TestRunBuildFromGitHubSpecialCase tests that build contexts starting with `github.com/` are special-cased, and the build command attempts to clone the remote repo. TODO: test "context selection" logic directly when runBuild is refactored to support testing (ex: docker/cli#294)
(t *testing.T)
| 119 | // TODO: test "context selection" logic directly when runBuild is refactored |
| 120 | // to support testing (ex: docker/cli#294) |
| 121 | func TestRunBuildFromGitHubSpecialCase(t *testing.T) { |
| 122 | t.Setenv("DOCKER_BUILDKIT", "0") |
| 123 | cmd := newBuildCommand(test.NewFakeCli(&fakeClient{})) |
| 124 | // Clone a small repo that exists so git doesn't prompt for credentials |
| 125 | cmd.SetArgs([]string{"github.com/docker/for-win"}) |
| 126 | cmd.SetOut(io.Discard) |
| 127 | cmd.SetErr(io.Discard) |
| 128 | err := cmd.Execute() |
| 129 | assert.ErrorContains(t, err, "unable to prepare context") |
| 130 | assert.ErrorContains(t, err, "docker-build-git") |
| 131 | } |
| 132 | |
| 133 | // TestRunBuildFromLocalGitHubDir tests that a local directory |
| 134 | // starting with `github.com` takes precedence over the `github.com` special |
nothing calls this directly
no test coverage detected
searching dependent graphs…