fix tests

This commit is contained in:
Robin Raymond 2018-02-18 12:57:06 +01:00
parent 436cf0513b
commit fd3754f43d

View file

@ -67,12 +67,20 @@ import <nixpkgs/nixos/tests/make-test.nix> {
environment.etc = { environment.etc = {
"root/.fetchmailrc" = { "root/.fetchmailrc" = {
text = '' text = ''
poll ${serverIP} with proto IMAP poll ${serverIP} with proto IMAP
user 'user1@example.com' there with password 'user1' is 'root' here user 'user1@example.com' there with password 'user1' is 'root' here
mda procmail mda procmail
''; '';
mode = "0700"; mode = "0700";
}; };
"root/.fetchmailRcLowQuota" = {
text = ''
poll ${serverIP} with proto IMAP
user 'lowquota\@example.com' there with password 'user1' is 'root' here
mda procmail
'';
mode = "0700";
};
"root/.procmailrc" = { "root/.procmailrc" = {
text = "DEFAULT=$HOME/mail"; text = "DEFAULT=$HOME/mail";
}; };
@ -151,7 +159,7 @@ import <nixpkgs/nixos/tests/make-test.nix> {
}; };
testScript = testScript =
'' ''
startAll; startAll;
$server->waitForUnit("multi-user.target"); $server->waitForUnit("multi-user.target");
@ -232,15 +240,10 @@ import <nixpkgs/nixos/tests/make-test.nix> {
subtest "quota", sub { subtest "quota", sub {
$client->execute("rm ~/mail/*"); $client->execute("rm ~/mail/*");
$client->execute("mv ~/.fetchmailRcLowQuota ~/.fetchmailrc");
$client->succeed("echo '${fetchmailRcLowQuota}' > ~/.fetchmailrc"); $client->succeed("msmtp -a test3 --tls=on --tls-certcheck=off --auth=on lowquota\@example.com < /etc/root/email2 >&2");
$client->succeed("sed -i s/SERVER/`getent hosts server | awk '{ print \$1 }'`/g ~/.fetchmailrc"); $server->waitUntilFails('[ "$(postqueue -p)" != "Mail queue is empty" ]');
$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 # fetchmail returns EXIT_CODE 0 when it retrieves mail
$client->fail("fetchmail -v"); $client->fail("fetchmail -v");