mirror of
https://github.com/golang/go.git
synced 2026-08-02 20:44:20 +08:00
cmd/go/testdata/script: don't use net in mod_sumdb_file_path test
Export the test sumdb to the test case as TESTGO_SUBDB. The test wants to check the proxy's supported file for the sumdb, so we need the name of the proxy's sumdb if we're going to use it. Then instead of the supported file in the sum.golang.org directory, we can use the name of the test sumdb instead. For #80243 Change-Id: I24a4bd43f4e21333052d0a90271f9c966a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/795904 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
4a5010f11e
commit
2772c8e119
@ -247,6 +247,7 @@ func scriptEnv(srv *vcstest.Server, srvCertFile string) ([]string, error) {
|
||||
"TESTGO_VCSTEST_CERT=" + srvCertFile,
|
||||
"TESTGONETWORK=panic", // cleared by the [net] condition
|
||||
"GOSUMDB=" + testSumDBVerifierKey,
|
||||
"TESTGO_SUMDB=" + testSumDBName,
|
||||
"GONOPROXY=",
|
||||
"GONOSUMDB=",
|
||||
"GOVCS=*:all",
|
||||
|
||||
@ -1,49 +1,48 @@
|
||||
[!net:proxy.golang.org] skip
|
||||
[!net:sum.golang.org] skip
|
||||
|
||||
env GO111MODULE=on
|
||||
[go-builder] env GOSUMDB=
|
||||
[!go-builder] env GOSUMDB=sum.golang.org # Set explicitly in case GOROOT/go.env is modified.
|
||||
env TESTPROXY=$GOPROXY
|
||||
env GOPATH=$WORK/gopath1
|
||||
|
||||
mkdir $WORK/sumproxy/sumdb/$TESTGO_SUMDB
|
||||
cp supported $WORK/sumproxy/sumdb/$TESTGO_SUMDB/supported
|
||||
|
||||
# With a file-based proxy with an empty checksum directory,
|
||||
# downloading a new module should fail, even if a subsequent
|
||||
# proxy contains a more complete mirror of the sum database.
|
||||
#
|
||||
# TODO(bcmills): The error message here is a bit redundant.
|
||||
# It comes from the sumweb package, which isn't yet producing structured errors.
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
|
||||
! go get golang.org/x/text@v0.3.2
|
||||
stderr '^go: golang.org/x/text@v0.3.2: verifying module: golang.org/x/text@v0.3.2: reading file://.*/sumdb/sum.golang.org/lookup/golang.org/x/text@v0.3.2: (no such file or directory|.*cannot find the path specified.*)'
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,$TESTPROXY
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,$TESTPROXY
|
||||
! go get rsc.io/quote@v1.5.2
|
||||
stderr '^go: rsc.io/quote@v1.5.2: verifying module: rsc.io/quote@v1.5.2: reading file://.*/sumdb/.*/lookup/rsc.io/quote@v1.5.2: (no such file or directory|.*cannot find the path specified.*)'
|
||||
|
||||
# If the proxy does not claim to support the database,
|
||||
# checksum verification should fall through to the next proxy,
|
||||
# and downloading should succeed.
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/emptyproxy,https://proxy.golang.org
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/emptyproxy,https://proxy.golang.org
|
||||
go get golang.org/x/text@v0.3.2
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/emptyproxy,$TESTPROXY
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/emptyproxy,$TESTPROXY
|
||||
go get rsc.io/quote@v1.5.2
|
||||
|
||||
# After a successful sumdb lookup, the lookup can be repeated
|
||||
# using the download cache as a proxy.
|
||||
cp supported $GOPATH/pkg/mod/cache/download/sumdb/sum.golang.org/supported
|
||||
cp supported $GOPATH/pkg/mod/cache/download/sumdb/$TESTGO_SUMDB/supported
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/gopath1/pkg/mod/cache/download,file:///$WORK/sumproxy
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download,file://$WORK/sumproxy
|
||||
env GOPATH=$WORK/gopath2
|
||||
rm go.sum
|
||||
go get -x -v golang.org/x/text@v0.3.2
|
||||
go get -x -v rsc.io/quote@v1.5.2
|
||||
|
||||
# Once the checksum is present in the go.sum file,
|
||||
# an empty file-based sumdb can be used in conjunction with
|
||||
# a fallback module mirror.
|
||||
grep golang.org/x/text go.sum
|
||||
grep rsc.io/quote go.sum
|
||||
env GOPATH=$WORK/gopath3
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy
|
||||
! go get golang.org/x/text@v0.3.2
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
|
||||
go get golang.org/x/text@v0.3.2
|
||||
! go get rsc.io/quote@v1.5.2
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,$TESTPROXY
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,$TESTPROXY
|
||||
go get rsc.io/quote@v1.5.2
|
||||
|
||||
-- supported --
|
||||
|
||||
@ -52,7 +51,3 @@ module example.com
|
||||
go 1.13
|
||||
-- $WORK/emptyproxy/README.md --
|
||||
This proxy contains no modules.
|
||||
-- $WORK/sumproxy/README.md --
|
||||
This proxy contains no modules.
|
||||
-- $WORK/sumproxy/sumdb/sum.golang.org/supported --
|
||||
This proxy blocks checksum downloads from sum.golang.org.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user