From d52d5f186c5560619e9c302f3d489033db251646 Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Wed, 8 Jan 2020 16:44:50 -0500 Subject: [PATCH] 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 --- src/cmd/go/go_test.go | 25 ------------------- .../testdata/script/get_insecure_update.txt | 11 ++++++++ 2 files changed, 11 insertions(+), 25 deletions(-) create mode 100644 src/cmd/go/testdata/script/get_insecure_update.txt diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index afb4cafb57..71d311af30 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -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") diff --git a/src/cmd/go/testdata/script/get_insecure_update.txt b/src/cmd/go/testdata/script/get_insecure_update.txt new file mode 100644 index 0000000000..792c868151 --- /dev/null +++ b/src/cmd/go/testdata/script/get_insecure_update.txt @@ -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 \ No newline at end of file -- 2.50.0