| 1 |
From: Reinhard Tartler <[email protected]> |
| 2 |
Date: Thu, 26 Dec 2024 07:20:35 -0500 |
| 3 |
Subject: Allow skipping tests that connect to the internet |
| 4 |
|
| 5 |
In isolated or offline build environments (such as Debian package build |
| 6 |
chroots), tests that attempt DNS lookups or external TCP connections fail. |
| 7 |
Skip the test when dialing external hosts fails. |
| 8 |
|
| 9 |
Bug-Debian: https://bugs.debian.org/1090825 |
| 10 |
Forwarded: not-needed |
| 11 |
Last-Update: 2026-09-25 |
| 12 |
--- |
| 13 |
signer/signer_test.go | 4 ++++ |
| 14 |
1 file changed, 4 insertions(+) |
| 15 |
|
| 16 |
diff --git a/signer/signer_test.go b/signer/signer_test.go |
| 17 |
index a2f8848..ef31e1d 100644 |
| 18 |
--- a/signer/signer_test.go |
| 19 |
+++ b/signer/signer_test.go |
| 20 |
@@ -27,6 +27,7 @@ import ( |
| 21 |
"os" |
| 22 |
"path/filepath" |
| 23 |
"regexp" |
| 24 |
+ "strings" |
| 25 |
"testing" |
| 26 |
"time" |
| 27 |
|
| 28 |
@@ -421,6 +422,9 @@ func validateSignWithCerts(t *testing.T, envelopeType string, key crypto.Private |
| 29 |
} |
| 30 |
sig, _, err := s.Sign(ctx, desc, sOpts) |
| 31 |
if err != nil { |
| 32 |
+ if strings.Contains(err.Error(), "dial tcp: lookup") { |
| 33 |
+ t.Skipf("Failed to connect to external host: %v", err) |
| 34 |
+ } |
| 35 |
t.Fatalf("Sign() error = %v", err) |
| 36 |
} |
| 37 |
|