]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: convert TestGoGetUpdateInsecure to the script framework
authorMichael Matloob <matloob@golang.org>
Wed, 8 Jan 2020 21:44:50 +0000 (16:44 -0500)
committerMichael Matloob <matloob@golang.org>
Wed, 19 Feb 2020 20:50:47 +0000 (20:50 +0000)
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>
src/cmd/go/go_test.go
src/cmd/go/testdata/script/get_insecure_update.txt [new file with mode: 0644]

index afb4cafb57c37a3031592402307dfd5c349f8e0c..71d311af307b1cf4e1efaf55096befc95d4b389b 100644 (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")
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 (file)
index 0000000..792c868
--- /dev/null
@@ -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