mirror of
https://github.com/golang/go
synced 2024-09-30 01:14:29 -06:00
cmd/go: convert two go get tests to the script framework
Part of converting all tests to script framework to improve test parallelism. Updates #36320 Updates #17751 Change-Id: Ib1ccc72fc717df79214480b48dd98188d6061b46 Reviewed-on: https://go-review.googlesource.com/c/go/+/214117 Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
d52d5f186c
commit
3c630bb400
@ -2552,55 +2552,6 @@ func TestImportLocal(t *testing.T) {
|
||||
tg.grepStderr("cannot import current directory", "did not diagnose import current directory")
|
||||
}
|
||||
|
||||
func TestGoGetUpdateUnknownProtocol(t *testing.T) {
|
||||
testenv.MustHaveExternalNetwork(t)
|
||||
testenv.MustHaveExecPath(t, "git")
|
||||
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.makeTempdir()
|
||||
tg.setenv("GOPATH", tg.path("."))
|
||||
|
||||
const repo = "github.com/golang/example"
|
||||
|
||||
// Clone the repo via HTTPS manually.
|
||||
repoDir := tg.path("src/" + repo)
|
||||
cmd := exec.Command("git", "clone", "-q", "https://"+repo, repoDir)
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("cloning %v repo: %v\n%s", repo, err, out)
|
||||
}
|
||||
|
||||
// Configure the repo to use a protocol unknown to cmd/go
|
||||
// that still actually works.
|
||||
cmd = exec.Command("git", "remote", "set-url", "origin", "xyz://"+repo)
|
||||
cmd.Dir = repoDir
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("git remote set-url: %v\n%s", err, out)
|
||||
}
|
||||
cmd = exec.Command("git", "config", "--local", "url.https://github.com/.insteadOf", "xyz://github.com/")
|
||||
cmd.Dir = repoDir
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("git config: %v\n%s", err, out)
|
||||
}
|
||||
|
||||
// We need -f to ignore import comments.
|
||||
tg.run("get", "-d", "-u", "-f", repo+"/hello")
|
||||
}
|
||||
|
||||
func TestGoGetInsecureCustomDomain(t *testing.T) {
|
||||
testenv.MustHaveExternalNetwork(t)
|
||||
testenv.MustHaveExecPath(t, "git")
|
||||
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.makeTempdir()
|
||||
tg.setenv("GOPATH", tg.path("."))
|
||||
|
||||
const repo = "insecure.go-get-issue-15410.appspot.com/pkg/p"
|
||||
tg.runFail("get", "-d", repo)
|
||||
tg.run("get", "-d", "-insecure", repo)
|
||||
}
|
||||
|
||||
func TestGoRunDirs(t *testing.T) {
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
|
5
src/cmd/go/testdata/script/get_insecure_custom_domain.txt
vendored
Normal file
5
src/cmd/go/testdata/script/get_insecure_custom_domain.txt
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
[!net] skip
|
||||
[!exec:git] skip
|
||||
|
||||
! go get -d insecure.go-get-issue-15410.appspot.com/pkg/p
|
||||
go get -d -insecure insecure.go-get-issue-15410.appspot.com/pkg/p
|
13
src/cmd/go/testdata/script/get_update_unknown_protocol.txt
vendored
Normal file
13
src/cmd/go/testdata/script/get_update_unknown_protocol.txt
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
[!net] skip
|
||||
[!exec:git] skip
|
||||
|
||||
# Clone the repo via HTTPS manually.
|
||||
exec git clone -q https://github.com/golang/example github.com/golang/example
|
||||
|
||||
# Configure the repo to use a protocol unknown to cmd/go
|
||||
# that still actually works.
|
||||
cd github.com/golang/example
|
||||
exec git remote set-url origin xyz://github.com/golang/example
|
||||
exec git config --local url.https://github.com/.insteadOf xyz://github.com/
|
||||
|
||||
go get -d -u -f github.com/golang/example/hello
|
Loading…
Reference in New Issue
Block a user