]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/go/testdata/script/gotoolchain_net.txt
cmd/go: additional doc-inspired tests and bug fixes
[gostls13.git] / src / cmd / go / testdata / script / gotoolchain_net.txt
index d04229d293747eb26d78d11539cc2ade40b51a7a..72bb2b72526980aaa0e000ce2f38839d22df8b1e 100644 (file)
@@ -1,8 +1,6 @@
 # This test only checks that basic network lookups work.
 # The full test of toolchain version selection is in gotoolchain.txt.
 
-[short] skip
-
 env TESTGO_VERSION=go1.21actual
 
 # GOTOOLCHAIN from network, does not exist
@@ -16,7 +14,34 @@ env GOTOOLCHAIN=go1.999testmod
 go version
 stderr 'go: downloading go1.999testmod \(.*/.*\)'
 
+# GOTOOLCHAIN cached from network
+go version
+! stderr downloading
+stdout go1.999testmod
+
+# GOTOOLCHAIN with GOSUMDB enabled but at a bad URL should operate in cache and not try badurl
+env oldsumdb=$GOSUMDB
+env GOSUMDB=$oldsumdb' http://badurl'
+go version
+! stderr downloading
+stdout go1.999testmod
+
+# GOTOOLCHAIN with GOSUMB=off should fail, because it cannot access even the cached sumdb info
+# without the sumdb name.
+env GOSUMDB=off
+! go version
+stderr '^go: golang.org/toolchain@v0.0.1-go1.999testmod.[a-z0-9\-]*: verifying module: checksum database disabled by GOSUMDB=off$'
+
+# GOTOOLCHAIN with GOSUMDB enabled but at a bad URL should fail if cache is incomplete
+env GOSUMDB=$oldsumdb' http://badurl'
+rm $GOPATH/pkg/mod/cache/download/sumdb
+! go version
+! stderr downloading
+stderr 'panic: use of network' # test catches network access
+env GOSUMDB=$oldsumdb
+
 # Test a real GOTOOLCHAIN
+[short] skip
 [!net:golang.org] skip
 [!GOOS:darwin] [!GOOS:windows] [!GOOS:linux] skip
 [!GOARCH:amd64] [!GOARCH:arm64] skip