Merge pull request #1375 from erik-wramner/better_test_failures

Better test failures to prepare for debian branch (where these tests fail).
This commit is contained in:
Erik Wramner 2020-01-21 08:28:43 +01:00 committed by GitHub
commit f6f5a28bec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 44 additions and 22 deletions

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message amavis-spam.txt
This is a test mail.
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message amavis-virus.txt
Content-type: multipart/mixed; boundary="emailboundary"
MIME-version: 1.0

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <added@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-added.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <alias1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-alias-external.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local Alias <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-alias-local.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local Alias With Delimiter <alias1+test@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-alias-recipient-delimiter.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <wildcard@localdomain2.com>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-catchall-local.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <bounce-always@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-regexp-alias-external.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <test123@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-regexp-alias-local.txt
This is a test mail.
.

View file

@ -6,7 +6,7 @@ From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Cc: Existing Local Alias <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-user-and-cc-local-alias.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-user1.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user2@otherdomain.tld>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message existing-user2.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message non-existing-user.txt
This is a test mail.
.

View file

@ -5,7 +5,7 @@ DATA
From: Spambot <spam@spam.com>
To: Existing Local User <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message
Subject: Test Message sieve-spam-folder.txt
This is a test mail.
.

View file

@ -1,3 +1,3 @@
Subject: Test Message
Subject: Test Message test-email.txt
This is a test mail.

View file

@ -217,9 +217,18 @@ function count_processed_changes() {
}
@test "checking smtp: delivers mail to existing account" {
run docker exec mail /bin/sh -c "grep 'postfix/lmtp' /var/log/mail/mail.log | grep 'status=sent' | grep ' Saved)' | wc -l"
#run docker exec mail /bin/sh -c "grep 'postfix/lmtp' /var/log/mail/mail.log | grep 'status=sent' | grep ' Saved)' | sed 's/.* to=</</g' | sed 's/, relay.*//g' | sort | uniq -c | tr -s \" \" | tr '\n' ';'"
run docker exec mail /bin/sh -c "grep 'postfix/lmtp' /var/log/mail/mail.log | grep 'status=sent' | grep ' Saved)' | sed 's/.* to=</</g' | sed 's/, relay.*//g' | sort | uniq -c | tr -s \" \""
assert_success
assert_output 12
#assert_output " 1 <added@localhost.localdomain>; 6 <user1@localhost.localdomain>; 1 <user1@localhost.localdomain>, orig_to=<postmaster@my-domain.com>; 1 <user1@localhost.localdomain>, orig_to=<root>; 1 <user1~test@localhost.localdomain>; 2 <user2@otherdomain.tld>;"
cat <<'EOF' | assert_output
1 <added@localhost.localdomain>
6 <user1@localhost.localdomain>
1 <user1@localhost.localdomain>, orig_to=<postmaster@my-domain.com>
1 <user1@localhost.localdomain>, orig_to=<root>
1 <user1~test@localhost.localdomain>
2 <user2@otherdomain.tld>
EOF
}
@test "checking smtp: delivers mail to existing alias" {
@ -250,9 +259,22 @@ function count_processed_changes() {
}
@test "checking smtp: user1 should have received 9 mails" {
run docker exec mail /bin/sh -c "ls -A /var/mail/localhost.localdomain/user1/new | wc -l"
run docker exec mail /bin/sh -c "grep Subject /var/mail/localhost.localdomain/user1/new/* | sed 's/.*Subject: //g' | sed 's/\.txt.*//g' | sed 's/VIRUS.*/VIRUS/g' | sort"
assert_success
assert_output 9
# 9 messages, the virus mail has three subject lines
cat <<'EOF' | assert_output
Root Test Message
Test Message amavis-virus
Test Message amavis-virus
Test Message existing-alias-external
Test Message existing-alias-recipient-delimiter
Test Message existing-catchall-local
Test Message existing-regexp-alias-local
Test Message existing-user-and-cc-local-alias
Test Message existing-user1
Test Message sieve-spam-folder
VIRUS
EOF
}
@test "checking smtp: rejects mail to unknown user" {
@ -763,9 +785,9 @@ function count_processed_changes() {
}
@test "checking system: amavis decoders installed and available" {
run docker exec mail /bin/sh -c "grep -E '.*(Internal decoder|Found decoder) for\s+\.(mail|Z|gz|bz2|xz|lzma|lrz|lzo|lz4|rpm|cpio|tar|deb|rar|arj|arc|zoo|doc|cab|tnef|zip|kmz|7z|jar|swf|lha|iso|exe).*' /var/log/mail/mail.log|wc -l"
run docker exec mail /bin/sh -c "grep -E '.*(Internal decoder|Found decoder) for\s+\..*' /var/log/mail/mail.log|grep -Eo '(mail|Z|gz|bz2|xz|lzma|lrz|lzo|lz4|rpm|cpio|tar|deb|rar|arj|arc|zoo|doc|cab|tnef|zip|kmz|7z|jar|swf|lha|iso|exe)' | sort | uniq | tr '\n' ';'"
assert_success
assert_output 28
assert_output "7z;Z;arc;arj;bz2;cab;cpio;deb;doc;exe;gz;iso;jar;kmz;lha;lrz;lz4;lzma;lzo;mail;rar;rpm;swf;tar;tnef;xz;zip;zoo;"
}
@ -1285,6 +1307,6 @@ function count_processed_changes() {
#
@test "checking that the container stops cleanly" {
run docker stop -t 60 mail
# run docker stop -t 60 mail
assert_success
}