From 9d7842878bb28335c826f1c37dfd315a0c7f5783 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sun, 24 Sep 2023 09:07:35 +0100 Subject: [PATCH] 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). --- test/t-04-aliases/run.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/t-04-aliases/run.sh b/test/t-04-aliases/run.sh index c88711f..1eb9573 100755 --- a/test/t-04-aliases/run.sh +++ b/test/t-04-aliases/run.sh @@ -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.