diff --git a/integration/signing_test.go b/integration/signing_test.go index 7678c6e6..49645051 100644 --- a/integration/signing_test.go +++ b/integration/signing_test.go @@ -1,12 +1,9 @@ package main import ( - "bytes" - "errors" "fmt" "os" "os/exec" - "strings" "testing" "github.com/stretchr/testify/require" @@ -29,16 +26,6 @@ type signingSuite struct { var _ = suite.SetupAllSuite(&signingSuite{}) -func findFingerprint(lineBytes []byte) (string, error) { - for line := range bytes.SplitSeq(lineBytes, []byte{'\n'}) { - fields := strings.Split(string(line), ":") - if len(fields) >= 10 && fields[0] == "fpr" { - return fields[9], nil - } - } - return "", errors.New("No fingerprint found") -} - func (s *signingSuite) SetupSuite() { t := s.T() _, err := exec.LookPath(skopeoBinary) diff --git a/integration/utils_test.go b/integration/utils_test.go index 0ce49766..d06aefbd 100644 --- a/integration/utils_test.go +++ b/integration/utils_test.go @@ -4,6 +4,7 @@ import ( "bytes" "compress/gzip" "encoding/json" + "errors" "io" "net" "net/netip" @@ -29,6 +30,17 @@ var skopeoBinary = func() string { return "skopeo" }() +// findFingerprint extracts the GPG key fingerprint from gpg --with-colons output. +func findFingerprint(lineBytes []byte) (string, error) { + for line := range bytes.SplitSeq(lineBytes, []byte{'\n'}) { + fields := strings.Split(string(line), ":") + if len(fields) >= 10 && fields[0] == "fpr" { + return fields[9], nil + } + } + return "", errors.New("No fingerprint found") +} + const ( testFQIN = "docker://quay.io/libpod/busybox" // tag left off on purpose, some tests need to add a special one testFQIN64 = "docker://quay.io/libpod/busybox:amd64"