From 6dd51d6e8835ddbaf1be495188ae7fe69a22bb8d Mon Sep 17 00:00:00 2001 From: Robin Raymond Date: Fri, 22 Dec 2017 16:58:49 +0100 Subject: [PATCH] add quota test --- tests/extern.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/extern.nix b/tests/extern.nix index 28fff3b..d407a5d 100644 --- a/tests/extern.nix +++ b/tests/extern.nix @@ -25,6 +25,7 @@ import { mailserver = { enable = true; + debug = true; fqdn = "mail.example.com"; domains = [ "example.com" "example2.com" ]; @@ -41,6 +42,10 @@ import { "user@example2.com" = { hashedPassword = "$6$u61JrAtuI0a$nGEEfTP5.eefxoScUGVG/Tl0alqla2aGax4oTd85v3j3xSmhv/02gNfSemv/aaMinlv9j/ZABosVKBrRvN5Qv0"; }; + "lowquota@example.com" = { + hashedPassword = "$6$u61JrAtuI0a$nGEEfTP5.eefxoScUGVG/Tl0alqla2aGax4oTd85v3j3xSmhv/02gNfSemv/aaMinlv9j/ZABosVKBrRvN5Qv0"; + quota = "1B"; + }; }; enableImap = true; @@ -62,6 +67,12 @@ import { user 'user1\@example.com' there with password 'user1' is 'root' here mda procmail ''; + fetchmailRcLowQuota = + '' + poll SERVER with proto IMAP + user 'lowquota\@example.com' there with password 'user1' is 'root' here + mda procmail + ''; procmailRc = '' @@ -231,6 +242,22 @@ import { $client->fail("fetchmail -v"); }; + subtest "quota", sub { + $client->succeed("rm mail.txt"); + + $client->succeed("echo '${fetchmailRcLowQuota}' > ~/.fetchmailrc"); + $client->succeed("sed -i s/SERVER/`getent hosts server | awk '{ print \$1 }'`/g ~/.fetchmailrc"); + + $client->succeed("chmod 0700 ~/.fetchmailrc"); + $client->succeed("echo '${email2}' > mail.txt"); + # send email from chuck to non exsitent account + $client->succeed("msmtp -a test3 --tls=on --tls-certcheck=off --auth=on lowquota\@example.com < mail.txt >&2"); + $client->succeed("sleep 5"); + # fetchmail returns EXIT_CODE 0 when it retrieves mail + $client->fail("fetchmail -v"); + + }; + '';