diff options
author | Robin Raymond <robin@robinraymond.de> | 2018-02-18 12:17:32 +0100 |
---|---|---|
committer | Robin Raymond <robin@robinraymond.de> | 2018-02-18 12:17:32 +0100 |
commit | 436cf0513b624b9210ce5e71066ed006a4287f09 (patch) | |
tree | cc3d973b4de242cac6a12a78269b80c29e342ae5 /tests | |
parent | 3c625fc1911399dac8906e177358e9d94940a0d5 (diff) | |
parent | 3b9b7961d4c6199198cf8f35678daf14648e62d9 (diff) |
add vitual mail users
Diffstat (limited to 'tests')
-rw-r--r-- | tests/extern.nix | 22 | ||||
-rw-r--r-- | tests/intern.nix | 8 |
2 files changed, 22 insertions, 8 deletions
diff --git a/tests/extern.nix b/tests/extern.nix index c06c983..0416f4e 100644 --- a/tests/extern.nix +++ b/tests/extern.nix @@ -25,6 +25,7 @@ import <nixpkgs/nixos/tests/make-test.nix> { mailserver = { enable = true; + debug = true; fqdn = "mail.example.com"; domains = [ "example.com" "example2.com" ]; dhParamBitLength = 512; @@ -42,6 +43,10 @@ import <nixpkgs/nixos/tests/make-test.nix> { "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; @@ -224,5 +229,22 @@ import <nixpkgs/nixos/tests/make-test.nix> { # if this succeeds, it means that user1 recieved the mail that was intended for chuck. $client->fail("fetchmail -v"); }; + + subtest "quota", sub { + $client->execute("rm ~/mail/*"); + + $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"); + + }; + ''; } diff --git a/tests/intern.nix b/tests/intern.nix index 9facc44..e191d60 100644 --- a/tests/intern.nix +++ b/tests/intern.nix @@ -45,14 +45,6 @@ import <nixpkgs/nixos/tests/make-test.nix> { $machine->start; $machine->waitForUnit("multi-user.target"); - subtest "user exists", sub { - $machine->succeed("cat /etc/shadow | grep 'user1\@example.com'"); - }; - - subtest "password is set", sub { - $machine->succeed("cat /etc/shadow | grep 'user1\@example.com:\$6\$/z4n8AQl6K\$kiOkBTWlZfBd7PvF5GsJ8PmPgdZsFGN1jPGZufxxr60PoR0oUsrvzm2oQiflyz5ir9fFJ.d/zKm/NgLXNUsNX/:1::::::'"); - }; - subtest "vmail gid is set correctly", sub { $machine->succeed("getent group vmail | grep 5000"); }; |