From faadae15ca8aec0c9d9da9d407b323b5253e45c8 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sun, 19 Jun 2022 11:54:55 +0100 Subject: [PATCH] tests: Detect buggy dkimpy versions, and skip the test if needed Some dkimpy versions have a bug where it can't parse the keys generated by its own key generator. That causes the dkimpy test to fail. See https://bugs.launchpad.net/dkimpy/+bug/1978835 for more details. This patch adds a workaround which detects the buggy version, and skip the test if needed. --- test/t-19-dkimpy/run.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/t-19-dkimpy/run.sh b/test/t-19-dkimpy/run.sh index e802ab7..48e06f5 100755 --- a/test/t-19-dkimpy/run.sh +++ b/test/t-19-dkimpy/run.sh @@ -28,6 +28,16 @@ fi generate_certs_for testserver ( mkdir -p .dkimcerts; cd .dkimcerts; dknewkey private > log 2>&1 ) +# Some dkimpy versions have a bug where it can't parse the keys generated by +# its own key generator. Detect if that's the case, and if so, skip the test. +# See https://bugs.launchpad.net/dkimpy/+bug/1978835. +if ! /usr/bin/dkimsign \ + testselector1 testserver .dkimcerts/private.key \ + < content 2>&1 | grep -q "DKIM-Signature:" +then + skip "buggy dkimpy version" +fi + add_user user@testserver secretpassword add_user someone@testserver secretpassword @@ -40,7 +50,9 @@ wait_until_ready 1025 run_msmtp someone@testserver < content wait_for_file .mail/someone@testserver mail_diff content .mail/someone@testserver -grep -q "DKIM-Signature:" .mail/someone@testserver +if ! grep -q "DKIM-Signature:" .mail/someone@testserver; then + fail "mail not signed, DKIM-Signature header missing" +fi # Verify the signature manually, just in case. # NOTE: This is using driusan/dkim instead of dkimpy, because dkimpy can't be