1
0
mirror of https://github.com/golang/go synced 2024-11-17 19:04:47 -07:00

cmd/go: convert TestGoGetUpdateInsecure to the script framework

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I1aa423a919e76de5b021d74d6df981d2f7fd43b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/213877
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Michael Matloob 2020-01-08 16:44:50 -05:00
parent b6ac393d1d
commit d52d5f186c
2 changed files with 11 additions and 25 deletions

View File

@ -2552,31 +2552,6 @@ func TestImportLocal(t *testing.T) {
tg.grepStderr("cannot import current directory", "did not diagnose import current directory")
}
func TestGoGetUpdateInsecure(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 HTTP manually.
cmd := exec.Command("git", "clone", "-q", "http://"+repo, tg.path("src/"+repo))
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("cloning %v repo: %v\n%s", repo, err, out)
}
// Update without -insecure should fail.
// Update with -insecure should succeed.
// We need -f to ignore import comments.
const pkg = repo + "/hello"
tg.runFail("get", "-d", "-u", "-f", pkg)
tg.run("get", "-d", "-u", "-f", "-insecure", pkg)
}
func TestGoGetUpdateUnknownProtocol(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
testenv.MustHaveExecPath(t, "git")

View File

@ -0,0 +1,11 @@
[!net] skip
[!exec:git] skip
# Clone the repo via HTTP manually.
exec git clone -q http://github.com/golang/example github.com/golang/example
# Update without -insecure should fail.
# Update with -insecure should succeed.
# We need -f to ignore import comments.
! go get -d -u -f github.com/golang/example/hello
go get -d -u -f -insecure github.com/golang/example/hello