cmd/go/testdata/script: don't use network in mod_gonoproxy test Create fake modules in the proxy that we intend to not fetch. For #80243 Change-Id: Iad6a205039fa2cf512073d5f4870ce776a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/795907 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/src/cmd/go/testdata/mod/vcs-test.golang.org_git_proxyonly.git_v0.0.1.txt b/src/cmd/go/testdata/mod/vcs-test.golang.org_git_proxyonly.git_v0.0.1.txt new file mode 100644 index 0000000..ce83076 --- /dev/null +++ b/src/cmd/go/testdata/mod/vcs-test.golang.org_git_proxyonly.git_v0.0.1.txt
@@ -0,0 +1,8 @@ +This is a module that could exist in a vcstest git repo, but that doesn't. + +-- .mod -- +module vcs-test.golang.org/git/proxyonly.git +-- .info -- +{"Version":"v0.0.1"} +-- proxyonly.go -- +package proxyonly
diff --git a/src/cmd/go/testdata/mod/vcs-test.golang.org_git_tagtests.git_v0.1.0.txt b/src/cmd/go/testdata/mod/vcs-test.golang.org_git_tagtests.git_v0.1.0.txt new file mode 100644 index 0000000..043bad3 --- /dev/null +++ b/src/cmd/go/testdata/mod/vcs-test.golang.org_git_tagtests.git_v0.1.0.txt
@@ -0,0 +1,9 @@ +There's a tagtests git repo, but add a proxy version, so we +can test that it's not available in mod_gonoproxy. + +-- .mod -- +module vcs-test.golang.org/git/tagtests.git +-- .info -- +{"Version":"v0.1.0"} +-- tagtests.go -- +package tagtests
diff --git a/src/cmd/go/testdata/script/mod_gonoproxy.txt b/src/cmd/go/testdata/script/mod_gonoproxy.txt index 94d03f2..d704c54 100644 --- a/src/cmd/go/testdata/script/mod_gonoproxy.txt +++ b/src/cmd/go/testdata/script/mod_gonoproxy.txt
@@ -35,21 +35,24 @@ ! go get golang.org/x/text stderr '^go: golang.org/x/text: module lookup disabled by GOPROXY=off$' +[short] skip 'the rest of the test uses git' + # GONOPROXY bypasses proxy -[!net:rsc.io] skip [!git] skip +env GOPROXY=$proxy +env GOSUMDB=$sumdb env GOPRIVATE=none -env GONOPROXY='*/fortune' -! go get rsc.io/fortune # does not exist in real world, only on test proxy +env GONOPROXY='*/git/proxyonly.git' +! go get vcs-test.golang.org/git/proxyonly.git # does not exist in vcstest, only on test proxy stderr 'git ls-remote' -[!net:golang.org] skip -env GOSUMDB= +env GOSUMDB=off env GONOPROXY= -env GOPRIVATE='*/x' -go get golang.org/x/text +env GOPRIVATE='*/git/tagtests.git' +go get vcs-test.golang.org/git/tagtests.git go list -m all -! stdout 'text.*v0.0.0-2017' # should not have the version from the proxy +stdout '^vcs-test.golang.org/git/tagtests.git v0.2.2$' +! stdout 'tagtests.git v0.1.0' # should not have the version from the proxy -- go.mod.orig -- module m