nixpkgs/nixos/tests/mailcatcher.nix
Christian Kauhaus dd87e9eb4d ssmtp: use services.ssmtp.* options
This PR is part of the networking.* namespace cleanup.

ssmtp used to be configured via `networking.defaultMailServer` which is
sort of misleading since it provides options only for ssmtp. Other
dumb mail relays like nullmailer have always been living under
services.

The intent of this PR is to align ssmtp's options with those of similar
services. Specifically, two renames have been done:

* Rename `networking.defaultMailHost` to `services.ssmtp`.
* Rename `directDelivery` to `enable` because this is what it basically does.
2019-11-26 11:08:44 +01:00

27 lines
691 B
Nix

import ./make-test.nix ({ lib, ... }:
{
name = "mailcatcher";
meta.maintainers = [ lib.maintainers.aanderse ];
machine =
{ pkgs, ... }:
{
services.mailcatcher.enable = true;
services.ssmtp.enable = true;
services.ssmtp.hostName = "localhost:1025";
environment.systemPackages = [ pkgs.mailutils ];
};
testScript = ''
startAll;
$machine->waitForUnit('mailcatcher.service');
$machine->waitForOpenPort('1025');
$machine->succeed('echo "this is the body of the email" | mail -s "subject" root@example.org');
$machine->succeed('curl http://localhost:1080/messages/1.source') =~ /this is the body of the email/ or die;
'';
})