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