aboutsummaryrefslogtreecommitdiff
path: root/internal/fetchdatasource
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2023-07-06 15:07:42 -0400
committerMichael Matloob <matloob@google.com>2023-07-06 20:20:20 +0000
commit127f46c73bd588d8248c3d281b87dca15e5b2e36 (patch)
tree1b72d7f4192e21928705f7d4d7d452fb3d45ba0f /internal/fetchdatasource
parent32beeac06f606f1bab4884bf112d40479e7b93ad (diff)
downloadgo-x-pkgsite-127f46c73bd588d8248c3d281b87dca15e5b2e36.tar.xz
internal/testenv: add and use MustHaveExternalNetwork function
This CL adds a copy of the MustHaveExternalNetwork function from the testenv package in the Go repo for use for filtering out tests that need the network access from running on builders that don't guarantee it. (External network access is only enabled on longtest builders). It also calls the function from two tests that are failing because they make external network calls. For #61209 Change-Id: I68ed1d3f8bb65697b1025bca0ba40aa0ab7423a3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/508295 Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Michael Matloob <matloob@google.com> TryBot-Bypass: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
Diffstat (limited to 'internal/fetchdatasource')
-rw-r--r--internal/fetchdatasource/fetchdatasource_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/fetchdatasource/fetchdatasource_test.go b/internal/fetchdatasource/fetchdatasource_test.go
index 8f931053..d913ad78 100644
--- a/internal/fetchdatasource/fetchdatasource_test.go
+++ b/internal/fetchdatasource/fetchdatasource_test.go
@@ -25,6 +25,7 @@ import (
"golang.org/x/pkgsite/internal/proxy/proxytest"
"golang.org/x/pkgsite/internal/source"
"golang.org/x/pkgsite/internal/stdlib"
+ "golang.org/x/pkgsite/internal/testenv"
"golang.org/x/pkgsite/internal/testing/testhelper"
"golang.org/x/pkgsite/internal/version"
)
@@ -428,6 +429,11 @@ func TestLocalGetUnitMeta(t *testing.T) {
},
} {
t.Run(test.path, func(t *testing.T) {
+ if test.modulePath == stdlib.ModulePath {
+ // FetchModule for the stdlib calls stdlib.Versions which makes a network
+ // call to go.googlesource.com for the Go git repo.
+ testenv.MustHaveExternalNetwork(t)
+ }
got, err := ds.GetUnitMeta(ctx, test.path, test.modulePath, fetch.LocalVersion)
if test.wantErr != nil {
if !errors.Is(err, test.wantErr) {