File: 0002-skip-tests-that-access-the-internet.patch

package info (click to toggle)
hugo 0.131.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 45,596 kB
  • sloc: javascript: 31,172; xml: 248; makefile: 73; sh: 42
file content (251 lines) | stat: -rw-r--r-- 7,345 bytes parent folder | download | duplicates (2)
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
Description: 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
Author: Anthony Fok <foka@debian.org>, William 'jawn-smith' Wilson <jawn-smith@ubuntu.com>
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
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/modules/client_test.go
+++ b/modules/client_test.go
@@ -33,6 +33,9 @@
 )
 
 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"
--- a/hugolib/hugo_modules_test.go
+++ b/hugolib/hugo_modules_test.go
@@ -39,6 +39,9 @@
 )
 
 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")
 	}
--- a/resources/resource_transformers/cssjs/postcss_integration_test.go
+++ b/resources/resource_transformers/cssjs/postcss_integration_test.go
@@ -15,6 +15,7 @@
 
 import (
 	"fmt"
+	"os"
 	"path/filepath"
 	"runtime"
 	"strings"
@@ -99,6 +100,9 @@
 `
 
 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 @@
 
 // 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 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 @@
 
 // #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 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 @@
 
 // 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")
 	}
--- 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 @@
 )
 
 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")
 	}
--- a/resources/resource_transformers/js/js_integration_test.go
+++ b/resources/resource_transformers/js/js_integration_test.go
@@ -14,6 +14,7 @@
 package js_test
 
 import (
+	"os"
 	"path/filepath"
 	"strings"
 	"testing"
@@ -76,6 +77,9 @@
 }
 
 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")
 	}
@@ -131,6 +135,9 @@
 }
 
 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")
 	}
--- a/resources/resource_factories/create/create_integration_test.go
+++ b/resources/resource_factories/create/create_integration_test.go
@@ -18,6 +18,7 @@
 	"math/rand"
 	"net/http"
 	"net/http/httptest"
+	"os"
 	"strings"
 	"testing"
 
@@ -25,6 +26,9 @@
 )
 
 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]
--- a/hugolib/embedded_shortcodes_test.go
+++ b/hugolib/embedded_shortcodes_test.go
@@ -14,12 +14,16 @@
 package hugolib
 
 import (
+	"os"
 	"testing"
 
 	"github.com/gohugoio/hugo/htesting"
 )
 
 func TestEmbeddedShortcodes(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 on non-CI for now")
 	}
--- a/hugolib/rebuild_test.go
+++ b/hugolib/rebuild_test.go
@@ -2,6 +2,7 @@
 
 import (
 	"fmt"
+	"os"
 	"path/filepath"
 	"strings"
 	"testing"
@@ -1152,6 +1153,9 @@
 }
 
 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")
 	}
--- 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"
@@ -22,6 +26,23 @@
 )
 
 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")
 	}