1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

test: Make t-04-aliases fail on unexpected mail

Today we check the aliases deliver mail to the expected locations, but
we don't fail if there are unexpected deliveries.

Doing so can help catch bugs (including test bugs), so this patch
implements that.

In addition, fix two of the tests that were printing on error, but not
causing the tests to fail (which was the original intention).
This commit is contained in:
Alberto Bertogli
2023-09-24 09:07:35 +01:00
parent f51b449c69
commit 9d7842878b

View File

@@ -21,6 +21,9 @@ function send_and_check() {
mail_diff content ".mail/$i@testserver"
rm -f ".mail/$i@testserver"
done
if ! [ -z "$(ls .mail/)" ]; then
fail "unexpected mail was delivered: $(ls .mail/)"
fi
}
# Remove the hooks that could be left over from previous failed tests.
@@ -58,12 +61,12 @@ mail_diff content .data/pipe_alias_worked
# Test when alias-resolve exits with an error
if run_msmtp roto@testserver < content 2> .logs/msmtp.out; then
echo "expected delivery to roto@ to fail, but succeeded"
fail "expected delivery to roto@ to fail, but succeeded"
fi
# Test a non-existent alias.
if run_msmtp nono@testserver < content 2> .logs/msmtp.out; then
echo "expected delivery to nono@ to fail, but succeeded"
fail "expected delivery to nono@ to fail, but succeeded"
fi
# Test chasquid-util's ability to do alias resolution talking to chasquid.