all: skip tests that use internet in short mode
Short tests aren't expected to access the internet, even if it happens
to be just proxy.golang.org. Caught by the new no-network check in LUCI.
Change-Id: Ie7f19ecf1b42ccf539f460ea3dedc905ab6e0819
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/510542
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/all_test.go b/all_test.go
index 7da86ec..4ebd685 100644
--- a/all_test.go
+++ b/all_test.go
@@ -18,6 +18,9 @@
t.Log("warning: running go test ./... will skip checking integration tests")
}
+ if testing.Short() {
+ t.Skip("skipping test that uses internet in short mode")
+ }
bash, err := exec.LookPath("bash")
if err != nil {
t.Skipf("skipping: %v", err)
diff --git a/cmd/govulncheck_sandbox/govulncheck_sandbox_test.go b/cmd/govulncheck_sandbox/govulncheck_sandbox_test.go
index 9ff5a7d..98e0d53 100644
--- a/cmd/govulncheck_sandbox/govulncheck_sandbox_test.go
+++ b/cmd/govulncheck_sandbox/govulncheck_sandbox_test.go
@@ -25,6 +25,9 @@
if runtime.GOOS == "windows" {
t.Skip("cannot run on Windows")
}
+ if testing.Short() {
+ t.Skip("skipping test that uses internet in short mode")
+ }
govulncheckPath, err := buildtest.BuildGovulncheck(t.TempDir())
if err != nil {
diff --git a/internal/buildbinary/bin_test.go b/internal/buildbinary/bin_test.go
index 9ea9a9c..354b177 100644
--- a/internal/buildbinary/bin_test.go
+++ b/internal/buildbinary/bin_test.go
@@ -51,6 +51,10 @@
}
func TestRunBuild(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping test that uses internet in short mode")
+ }
+
tests := []struct {
name string
modulePath string
diff --git a/internal/worker/govulncheck_scan_test.go b/internal/worker/govulncheck_scan_test.go
index ac18604..83c53be 100644
--- a/internal/worker/govulncheck_scan_test.go
+++ b/internal/worker/govulncheck_scan_test.go
@@ -83,6 +83,10 @@
// left here is checking that runsc is initiated properly. It is
// not clear how to do that here nor is it necessary.
func TestRunScanModuleInsecure(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping test that uses internet in short mode")
+ }
+
govulncheckPath, err := buildtest.BuildGovulncheck(t.TempDir())
if err != nil {
t.Fatal(err)