]> git.corax.cc Git - toolbox/commitdiff
test: Set default GPG key when testing ipc module
authorMatthias Kruk <m@m10k.eu>
Tue, 27 Dec 2022 05:53:23 +0000 (14:53 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 27 Dec 2022 05:53:23 +0000 (14:53 +0900)
When initializing the environment for tests of the ipc module, the
default GPG key is not explicitly set. Because newer GPG versions do
not automatically set the default key, no default key is set, causing
sign operations to fail.

This commit modifies the test cases for the ipc module so that the
default GPG key is set during the test setup.

The default key is not set automatically on newer GPG versions

test/ipc_spec.sh

index 01549e0462b32d984b3db6e484ea2f69cbb3663f..c45aa63a042392b057155cd77bdd4ccbc83fc59e 100644 (file)
@@ -22,6 +22,8 @@ export PATH="$PWD/..:$PATH"
 include "ipc"
 
 setup() {
+       local keyfp
+
        if ! mkdir -p "/tmp/test.$$"; then
                return 1
        fi
@@ -51,6 +53,14 @@ EOF
                return 1
        fi
 
+       if ! keypf=$(gpg -K 2>/dev/null | grep -m 1 -oP '[0-9a-fA-F]{40}'); then
+               return 2
+       fi
+
+       if ! printf 'default-key %s\nquiet\n' "$keypf" > "/tmp/test.$$/gpg.conf"; then
+               return 3
+       fi
+
        return 0
 }