From c99ea1c2039b57c20bf058184ee77d06f4d78d10 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 27 Mar 2019 07:35:24 -0400 Subject: nixos/mailcatcher: add nixos test --- nixos/tests/mailcatcher.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nixos/tests/mailcatcher.nix (limited to 'nixos/tests/mailcatcher.nix') diff --git a/nixos/tests/mailcatcher.nix b/nixos/tests/mailcatcher.nix new file mode 100644 index 00000000000..1bed13b23f6 --- /dev/null +++ b/nixos/tests/mailcatcher.nix @@ -0,0 +1,26 @@ +import ./make-test.nix ({ lib, ... }: + +{ + name = "mailcatcher"; + meta.maintainers = [ lib.maintainers.aanderse ]; + + machine = + { pkgs, ... }: + { + services.mailcatcher.enable = true; + + networking.defaultMailServer.directDelivery = true; + networking.defaultMailServer.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.json') =~ /this is the body of the email/ or die; + ''; +}) -- cgit 1.4.1