mirror of
https://github.com/golang/go.git
synced 2026-04-03 09:49:56 +09:00
cmd/go/testdata/script: update more tests to not use network
For these tests, I've been able to use modules that are in the local proxy and vcstest server (or add modules to them where modules didn't already exist) to exercise the tested functionality of the go command. This should help make our longtests run faster and be less flaky. This CL also removes lines in the tests that set GO111MODULE=on since that's now the default. Change-Id: Ie0b2c905850f84100213e1ab35ec2a226a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/753140 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Alexander <jitsu@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Matloob <matloob@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Auto-Submit: Michael Matloob <matloob@golang.org>
This commit is contained in:
committed by
Gopher Robot
parent
e715e208f2
commit
16cebc1165
13
src/cmd/go/testdata/mod/vcs-test.golang.org_git_hello.git_v0.0.0-20170922010558-fc3a09f3dc5c.txt
vendored
Normal file
13
src/cmd/go/testdata/mod/vcs-test.golang.org_git_hello.git_v0.0.0-20170922010558-fc3a09f3dc5c.txt
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
written by hand
|
||||
|
||||
-- .mod --
|
||||
module vcs-test.golang.org/git/hello.git
|
||||
-- .info --
|
||||
{"Version":"v0.0.0-20170922010558-fc3a09f3dc5c"}
|
||||
-- testonly.go --
|
||||
package main
|
||||
|
||||
func main() {
|
||||
println("hello, world")
|
||||
}
|
||||
|
||||
20
src/cmd/go/testdata/script/get_insecure.txt
vendored
20
src/cmd/go/testdata/script/get_insecure.txt
vendored
@@ -1,4 +1,5 @@
|
||||
[!net:insecure.go-get-issue-15410.appspot.com] skip
|
||||
# Test for #15410
|
||||
[short] skip 'builds a go program and a git repo'
|
||||
[!git] skip
|
||||
|
||||
env PATH=$WORK/tmp/bin${:}$PATH
|
||||
@@ -9,24 +10,23 @@ env GOPATH=$WORK/m/gp
|
||||
mkdir $WORK/m
|
||||
cp module_file $WORK/m/go.mod
|
||||
cd $WORK/m
|
||||
env GO111MODULE=on
|
||||
env GOPROXY=''
|
||||
env GOPROXY=${GOPROXY},direct
|
||||
|
||||
# Modules: Try go get -d of HTTP-only repo (should fail).
|
||||
! go get -d insecure.go-get-issue-15410.appspot.com/pkg/p
|
||||
# Modules: Try go get of HTTP-only repo (should fail).
|
||||
! go get -d vcs-test.golang.org/insecure/go/insecure@6fecd21
|
||||
|
||||
# Modules: Try again with GOINSECURE (should succeed).
|
||||
env GOINSECURE=insecure.go-get-issue-15410.appspot.com
|
||||
env GONOSUMDB=insecure.go-get-issue-15410.appspot.com
|
||||
go get -d insecure.go-get-issue-15410.appspot.com/pkg/p
|
||||
env GOINSECURE=vcs-test.golang.org/insecure/go/insecure
|
||||
env GONOSUMDB=vcs-test.golang.org/insecure
|
||||
go get -d vcs-test.golang.org/insecure/go/insecure@6fecd21
|
||||
|
||||
# Modules: Try updating without GOINSECURE (should fail).
|
||||
env GOINSECURE=''
|
||||
env GONOSUMDB=''
|
||||
! go get -d -u -f insecure.go-get-issue-15410.appspot.com/pkg/p
|
||||
! go get -d -u -f vcs-test.golang.org/insecure/go/insecure@6fecd21
|
||||
|
||||
go list -m ...
|
||||
stdout 'insecure.go-get-issue'
|
||||
stdout 'vcs-test.golang.org/insecure/go/insecure'
|
||||
|
||||
-- ssh.go --
|
||||
// stub out uses of ssh by go get
|
||||
|
||||
20
src/cmd/go/testdata/script/mod_download_hash.txt
vendored
20
src/cmd/go/testdata/script/mod_download_hash.txt
vendored
@@ -1,20 +1,18 @@
|
||||
env GO111MODULE=on
|
||||
|
||||
# Testing mod download with non semantic versions; turn off proxy.
|
||||
[!net:rsc.io] skip
|
||||
[short] skip
|
||||
[!git] skip
|
||||
env GOPROXY=direct
|
||||
env GOSUMDB=off
|
||||
|
||||
go mod download rsc.io/quote@a91498bed0a73d4bb9c1fb2597925f7883bc40a7
|
||||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.info
|
||||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.mod
|
||||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.zip
|
||||
go mod download vcs-test.golang.org/git/hello.git@fc3a09f
|
||||
exists $GOPATH/pkg/mod/cache/download/vcs-test.golang.org/git/hello.git/@v/v0.0.0-20170922010558-fc3a09f3dc5c.info
|
||||
exists $GOPATH/pkg/mod/cache/download/vcs-test.golang.org/git/hello.git/@v/v0.0.0-20170922010558-fc3a09f3dc5c.mod
|
||||
exists $GOPATH/pkg/mod/cache/download/vcs-test.golang.org/git/hello.git/@v/v0.0.0-20170922010558-fc3a09f3dc5c.zip
|
||||
|
||||
go mod download rsc.io/quote@master
|
||||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.info
|
||||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.mod
|
||||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-0.20180709162918-a91498bed0a7.zip
|
||||
go mod download vcs-test.golang.org/git/hello.git@master
|
||||
exists $GOPATH/pkg/mod/cache/download/vcs-test.golang.org/git/hello.git/@v/v0.0.0-20170922010558-fc3a09f3dc5c.info
|
||||
exists $GOPATH/pkg/mod/cache/download/vcs-test.golang.org/git/hello.git/@v/v0.0.0-20170922010558-fc3a09f3dc5c.mod
|
||||
exists $GOPATH/pkg/mod/cache/download/vcs-test.golang.org/git/hello.git/@v/v0.0.0-20170922010558-fc3a09f3dc5c.zip
|
||||
|
||||
|
||||
-- go.mod --
|
||||
|
||||
15
src/cmd/go/testdata/script/mod_get_fallback.txt
vendored
15
src/cmd/go/testdata/script/mod_get_fallback.txt
vendored
@@ -1,14 +1,11 @@
|
||||
env GO111MODULE=on
|
||||
|
||||
[!net:golang.org] skip
|
||||
[!net:proxy.golang.org] skip
|
||||
|
||||
env GOPROXY=https://proxy.golang.org,direct
|
||||
env GOSUMDB=off
|
||||
|
||||
go get -x -v golang.org/x/tools/cmd/goimports
|
||||
stderr '# get https://proxy.golang.org/golang.org/x/tools/@v/list'
|
||||
! stderr '# get https://golang.org'
|
||||
env LOCALMODPROXY=$GOPROXY
|
||||
env GOPROXY=$LOCALMODPROXY,direct
|
||||
|
||||
go get -x -v vcs-test.golang.org/git/hello.git
|
||||
stderr '# get '$LOCALMODPROXY'/vcs-test.golang.org/git/hello.git/@v/list'
|
||||
! stderr '# get https://vcs-test.golang.org'
|
||||
|
||||
-- go.mod --
|
||||
module m
|
||||
|
||||
11
src/cmd/go/testdata/script/mod_get_hash.txt
vendored
11
src/cmd/go/testdata/script/mod_get_hash.txt
vendored
@@ -1,18 +1,17 @@
|
||||
env GO111MODULE=on
|
||||
env GOPROXY=direct
|
||||
env GOSUMDB=off
|
||||
[!net:golang.org] skip
|
||||
[short] skip
|
||||
[!git] skip
|
||||
|
||||
# fetch commit hash reachable from refs/heads/* and refs/tags/* is OK
|
||||
go list -m golang.org/x/time@8be79e1e0910c292df4e79c241bb7e8f7e725959 # on master branch
|
||||
go list -m vcs-test.golang.org/git/unreachable-hash.git@6c0e37b1dcaab081b5c413108a46669027fcf02b # on main branch
|
||||
|
||||
# fetch other commit hash, even with a non-standard ref, is not OK
|
||||
! go list -m golang.org/x/time@334d83c35137ac2b376c1dc3e4c7733791855a3a # refs/changes/24/41624/3
|
||||
! go list -m vcs-test.golang.org/git/unreachable-hash.git@cbd2996c52d20dac558bc3b49c342c7c8320a1fc
|
||||
stderr 'unknown revision'
|
||||
! go list -m golang.org/x/time@v0.0.0-20170424233410-334d83c35137
|
||||
! go list -m vcs-test.golang.org/git/unreachable-hash.git@v0.0.0-20170424233410-cbd2996c52d2
|
||||
stderr 'unknown revision'
|
||||
! go list -m golang.org/x/time@334d83c35137
|
||||
! go list -m vcs-test.golang.org/git/unreachable-hash.git@cbd2996c52d2
|
||||
stderr 'unknown revision'
|
||||
|
||||
-- go.mod --
|
||||
|
||||
9
src/cmd/go/testdata/script/mod_getx.txt
vendored
9
src/cmd/go/testdata/script/mod_getx.txt
vendored
@@ -1,15 +1,14 @@
|
||||
[!net:golang.org] skip
|
||||
[short] skip
|
||||
[!git] skip
|
||||
|
||||
env GO111MODULE=on
|
||||
env GOPROXY=direct
|
||||
env GOSUMDB=off
|
||||
|
||||
# 'go get -x' should log URLs with an HTTP or HTTPS scheme.
|
||||
# A bug had caused us to log schemeless URLs instead.
|
||||
go get -x golang.org/x/text@v0.1.0
|
||||
stderr '^# get https://golang.org/x/text\?go-get=1$'
|
||||
stderr '^# get https://golang.org/x/text\?go-get=1: 200 OK \([0-9.]+s\)$'
|
||||
go get -x vcs-test.golang.org/go/mod/gitrepo1@v1.2.3
|
||||
stderr '^# get https://vcs-test.golang.org/go/mod/gitrepo1\?go-get=1$'
|
||||
stderr '^# get https://vcs-test.golang.org/go/mod/gitrepo1\?go-get=1: 200 OK \([0-9.]+s\)$'
|
||||
! stderr '^# get //.*'
|
||||
|
||||
-- go.mod --
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
[exec:bzr] skip 'tests NOT having bzr'
|
||||
[!net:launchpad.net] skip
|
||||
[short] skip
|
||||
|
||||
env GO111MODULE=on
|
||||
env GOPROXY=direct
|
||||
|
||||
cd empty
|
||||
! go get launchpad.net/gocheck
|
||||
! go get vcs-test.golang.org/foo.bzr
|
||||
stderr '"bzr": executable file not found'
|
||||
cd ..
|
||||
|
||||
@@ -23,6 +22,6 @@ module m
|
||||
-- main/main.go --
|
||||
package main
|
||||
|
||||
import _ "launchpad.net/gocheck"
|
||||
import _ "vcs-test.golang.org/foo.bzr"
|
||||
|
||||
func main() {}
|
||||
|
||||
31
src/cmd/go/testdata/vcstest/git/unreachable-hash.txt
vendored
Normal file
31
src/cmd/go/testdata/vcstest/git/unreachable-hash.txt
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
handle git
|
||||
|
||||
env GIT_AUTHOR_NAME='Michael Matloob'
|
||||
env GIT_AUTHOR_EMAIL='matloob@golang.org'
|
||||
env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
|
||||
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
|
||||
|
||||
at 2017-04-24T23:34:10-00:00
|
||||
|
||||
git init
|
||||
cp go.mod.orig go.mod
|
||||
git add go.mod
|
||||
git write-tree
|
||||
git commit-tree 995c9bbddb810e9fe22d0ba73d661c599eec29e8 -m foo
|
||||
git checkout cbd2996c52d20dac558bc3b49c342c7c8320a1fc
|
||||
|
||||
git switch --orphan main
|
||||
mv go.mod.orig go.mod
|
||||
git add go.mod
|
||||
git commit -m bar
|
||||
|
||||
git log --oneline --decorate=short main cbd2996c52d20dac558bc3b49c342c7c8320a1fc
|
||||
cmp stdout .git-log
|
||||
|
||||
-- .git-log --
|
||||
6c0e37b (HEAD -> main) bar
|
||||
cbd2996 foo
|
||||
-- go.mod.orig --
|
||||
module vcs-test.golang.org/git/ureachable-hash.git
|
||||
|
||||
go 1.26
|
||||
Reference in New Issue
Block a user