1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
|
From: "Dr. Tobias Quathamer" <toddy@debian.org>
Date: Wed, 24 Sep 2025 22:18:30 +0200
Subject: Skip tests that access the Internet during Debian build
But let the test run during autopkgtest. Examples include:
- TestTransformPostCSS runs "npm install" which accesses the Internet
- TestHugoModulesVariants pulls in github.com/gohugoio/hugoTestModule2
- TestEmbeddedShortcodes where {{< tweet >}} shortcode accesses the Internet
Origin: vendor
Forwarded: not-needed
Last-Update: 2021-01-27, 2022-02-23, 2022-06-07, 2022-06-08, 2023-03-09, 2023-07-06, 2023-10-10, 2024-02-23, 2024-07-14, 2024-08-18
---
hugolib/hugo_modules_test.go | 3 +++
hugolib/rebuild_test.go | 4 ++++
modules/client_test.go | 3 +++
.../create/create_integration_test.go | 4 ++++
.../babel/babel_integration_test.go | 4 ++++
.../cssjs/postcss_integration_test.go | 19 +++++++++++++++++++
.../cssjs/tailwindcss_integration_test.go | 21 +++++++++++++++++++++
.../resource_transformers/js/js_integration_test.go | 6 ++++++
8 files changed, 64 insertions(+)
diff --git a/hugolib/hugo_modules_test.go b/hugolib/hugo_modules_test.go
index 2434478..37bcaab 100644
--- a/hugolib/hugo_modules_test.go
+++ b/hugolib/hugo_modules_test.go
@@ -39,6 +39,9 @@ import (
)
func TestHugoModulesVariants(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("skip (relative) long running modules test when running locally")
}
diff --git a/hugolib/rebuild_test.go b/hugolib/rebuild_test.go
index 38752b9..207df21 100644
--- a/hugolib/rebuild_test.go
+++ b/hugolib/rebuild_test.go
@@ -2,6 +2,7 @@ package hugolib
import (
"fmt"
+ "os"
"path/filepath"
"strings"
"testing"
@@ -1394,6 +1395,9 @@ foo();
}
func TestRebuildVariationsAssetsPostCSSImport(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("skip CI only")
}
diff --git a/modules/client_test.go b/modules/client_test.go
index 78fdb92..90a060f 100644
--- a/modules/client_test.go
+++ b/modules/client_test.go
@@ -34,6 +34,9 @@ import (
)
func TestClient(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("skip test as network access is not allowed during Debian package build")
+ }
modName := "hugo-modules-basic-test"
modPath := "github.com/gohugoio/tests/" + modName
defaultImport := "modh2_2"
diff --git a/resources/resource_factories/create/create_integration_test.go b/resources/resource_factories/create/create_integration_test.go
index 0ed4372..40ebbc7 100644
--- a/resources/resource_factories/create/create_integration_test.go
+++ b/resources/resource_factories/create/create_integration_test.go
@@ -18,6 +18,7 @@ import (
"math/rand"
"net/http"
"net/http/httptest"
+ "os"
"strings"
"testing"
@@ -25,6 +26,9 @@ import (
)
func TestGetRemoteHead(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
files := `
-- config.toml --
[security]
diff --git a/resources/resource_transformers/babel/babel_integration_test.go b/resources/resource_transformers/babel/babel_integration_test.go
index 44a13f1..c9f4434 100644
--- a/resources/resource_transformers/babel/babel_integration_test.go
+++ b/resources/resource_transformers/babel/babel_integration_test.go
@@ -14,6 +14,7 @@
package babel_test
import (
+ "os"
"testing"
"github.com/bep/logg"
@@ -22,6 +23,9 @@ import (
)
func TestTransformBabel(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("Skip long running test when running locally")
}
diff --git a/resources/resource_transformers/cssjs/postcss_integration_test.go b/resources/resource_transformers/cssjs/postcss_integration_test.go
index a05f340..3d5f5ed 100644
--- a/resources/resource_transformers/cssjs/postcss_integration_test.go
+++ b/resources/resource_transformers/cssjs/postcss_integration_test.go
@@ -15,6 +15,7 @@ package cssjs_test
import (
"fmt"
+ "os"
"path/filepath"
"runtime"
"strings"
@@ -99,6 +100,9 @@ module.exports = {
`
func TestTransformPostCSS(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("Skip long running test when running locally")
}
@@ -143,6 +147,9 @@ Styles Content: Len: 770917|
// 9880
func TestTransformPostCSSError(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("Skip long running test when running locally")
}
@@ -167,6 +174,9 @@ func TestTransformPostCSSError(t *testing.T) {
}
func TestTransformPostCSSNotInstalledError(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("Skip long running test when running locally")
}
@@ -186,6 +196,9 @@ func TestTransformPostCSSNotInstalledError(t *testing.T) {
// #9895
func TestTransformPostCSSImportError(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("Skip long running test when running locally")
}
@@ -207,6 +220,9 @@ func TestTransformPostCSSImportError(t *testing.T) {
}
func TestTransformPostCSSImporSkipInlineImportsNotFound(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("Skip long running test when running locally")
}
@@ -230,6 +246,9 @@ func TestTransformPostCSSImporSkipInlineImportsNotFound(t *testing.T) {
// Issue 9787
func TestTransformPostCSSResourceCacheWithPathInBaseURL(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("Skip long running test when running locally")
}
diff --git a/resources/resource_transformers/cssjs/tailwindcss_integration_test.go b/resources/resource_transformers/cssjs/tailwindcss_integration_test.go
index 734ffe7..9715b42 100644
--- a/resources/resource_transformers/cssjs/tailwindcss_integration_test.go
+++ b/resources/resource_transformers/cssjs/tailwindcss_integration_test.go
@@ -14,6 +14,10 @@
package cssjs_test
import (
+ "os"
+ "os/exec"
+ "runtime"
+ "strings"
"testing"
"github.com/bep/logg"
@@ -23,6 +27,23 @@ import (
)
func TestTailwindV4Basic(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
+ if !(runtime.GOARCH == "amd64" || runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
+ t.Skipf("Skip test: prebuild of @parcel/watcher is available only for x64 (amd64), arm and arm64; see https://www.npmjs.com/search?q=%%40parcel%%2Fwatcher-linux")
+ }
+ if runtime.GOARCH == "arm" {
+ cmd := exec.Command("/usr/bin/go", "env", "GOARM")
+ out, err := cmd.Output()
+ if err != nil {
+ t.Skipf("Skip test: failed to check GOARM: %v: %v", cmd, err)
+ }
+ goarm := strings.TrimSpace(string(out))
+ if goarm == "5,softfloat" {
+ t.Skipf("Skip test: prebuild of @parcel/watcher is available for armhf but not for armel (GOARM=%v); see https://www.npmjs.com/search?q=%%40parcel%%2Fwatcher-linux", goarm)
+ }
+ }
if !htesting.IsCI() {
t.Skip("Skip long running test when running locally")
}
diff --git a/resources/resource_transformers/js/js_integration_test.go b/resources/resource_transformers/js/js_integration_test.go
index 9cee19a..b9514f7 100644
--- a/resources/resource_transformers/js/js_integration_test.go
+++ b/resources/resource_transformers/js/js_integration_test.go
@@ -79,6 +79,9 @@ JS Content:{{ $js.Content }}:End:
}
func TestBuildWithModAndNpm(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("skip (relative) long running modules test when running locally")
}
@@ -134,6 +137,9 @@ module.exports = window.ReactDOM;
}
func TestBuildWithNpm(t *testing.T) {
+ if os.Getenv("AUTOPKGTEST_TMP") == "" {
+ t.Skip("Skip test as network is inaccessible during Debian package build")
+ }
if !htesting.IsCI() {
t.Skip("skip (relative) long running modules test when running locally")
}
|