aports/community/distrobuilder/skip-testverifyfile.patch
mio dcbbed7f49 community/distrobuilder: conditionally skip failed test
Skip the TestVerifyFile and TestCreateGPGKeyring tests from
common_test.go if an initial keyserver connection check fails.
2025-10-11 04:22:14 +00:00

35 lines
1019 B
Diff

diff -ruN a/sources/common_test.go b/sources/common_test.go
--- a/sources/common_test.go 2025-04-03 20:45:57.000000000 +0000
+++ b/sources/common_test.go 2025-10-11 04:21:40.100000000 +0000
@@ -25,6 +25,14 @@
keys := []string{"0x5DE8949A899C8D99"}
keyserver := "keyserver.ubuntu.com"
+ // Skip test if connection cannot be established with the keyserver
+ var ok bool
+ ok, err = recvGPGKeys(context.TODO(), os.TempDir(), keyserver, keys)
+ if !ok {
+ log.Printf("%s", err)
+ t.Skip("Test skipped due to connection error")
+ }
+
tests := []struct {
name string
signedFile string
@@ -124,6 +132,15 @@
ctx: context.TODO(),
}
+ // Skip test if connection cannot be established with the keyserver
+ var ok bool
+ var err error
+ ok, err = recvGPGKeys(c.ctx, c.sourcesDir, c.definition.Source.Keyserver, c.definition.Source.Keys)
+ if !ok {
+ log.Printf("%s", err)
+ t.Skip("Test skipped due to connection error")
+ }
+
keyring, err := c.CreateGPGKeyring()
require.NoError(t, err)