aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/script_test.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2022-07-30 02:54:32 -0400
committerGopher Robot <gobot@golang.org>2022-10-25 13:00:34 +0000
commitd5155f61928a55e570beaa214465bc48ddd2c16c (patch)
tree78af44035e9dabe8156d930bb43ff868a2a120af /src/cmd/go/script_test.go
parent55eaae452cf69df768b2aaf6045db22d6c1a4029 (diff)
downloadgo-d5155f61928a55e570beaa214465bc48ddd2c16c.tar.gz
go-d5155f61928a55e570beaa214465bc48ddd2c16c.zip
cmd/go: redirect vcs-test.golang.org repo URLs to a test-local server
The new server reconstructs the vcs-test repos on the fly using scripts that run the actual version-control binaries. This allows those repos to be code-reviewed using our normal tools — and, crucially, allows contributors to add new vcs-test contents as part of a contributed CL. It also prevents failures due to network errors reaching vcs-test.golang.org (such as when developing offline), and allows us to iterate on the repo contents without dealing with annoying and unpredictable GCS caching behavior. We can't quite turn down vcs-test.golang.org yet — this server doesn't yet handle "go-import" metadata (and related authentication behaviors), and doesn't serve Subversion repos. But we're getting much closer! For #27494. Change-Id: I233fc718617aed287b0f7248bd8cfe1e5cebe96b Reviewed-on: https://go-review.googlesource.com/c/go/+/421455 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/cmd/go/script_test.go')
-rw-r--r--src/cmd/go/script_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go
index f0fe6d0460..a2d2cae658 100644
--- a/src/cmd/go/script_test.go
+++ b/src/cmd/go/script_test.go
@@ -29,6 +29,8 @@ import (
"cmd/go/internal/cfg"
"cmd/go/internal/script"
"cmd/go/internal/script/scripttest"
+ "cmd/go/internal/vcs"
+ "cmd/go/internal/vcweb/vcstest"
)
var testSum = flag.String("testsum", "", `may be tidy, listm, or listall. If set, TestScript generates a go.sum file at the beginning of each test and updates test files if they pass.`)
@@ -38,6 +40,16 @@ func TestScript(t *testing.T) {
testenv.MustHaveGoBuild(t)
testenv.SkipIfShortAndSlow(t)
+ srv, err := vcstest.NewServer()
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(func() {
+ if err := srv.Close(); err != nil {
+ t.Fatal(err)
+ }
+ })
+
StartProxy()
var (
@@ -187,6 +199,7 @@ func scriptEnv() ([]string, error) {
"GOROOT_FINAL=" + testGOROOT_FINAL, // causes spurious rebuilds and breaks the "stale" built-in if not propagated
"GOTRACEBACK=system",
"TESTGO_GOROOT=" + testGOROOT,
+ "TESTGO_VCSTEST_URL=" + vcs.VCSTestRepoURL,
"GOSUMDB=" + testSumDBVerifierKey,
"GONOPROXY=",
"GONOSUMDB=",