summary refs log tree commit diff
path: root/nixos/tests/mailcatcher.nix
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2019-03-27 07:35:24 -0400
committerAaron Andersen <aaron@fosslib.net>2019-03-27 09:56:46 -0400
commitc99ea1c2039b57c20bf058184ee77d06f4d78d10 (patch)
tree1d9b4ab59018f65e3d4db9ef119f79b3e81bc09d /nixos/tests/mailcatcher.nix
parent395ec8c0d4e179d185a18a1d785bd708133928e2 (diff)
downloadnixpkgs-c99ea1c2039b57c20bf058184ee77d06f4d78d10.tar
nixpkgs-c99ea1c2039b57c20bf058184ee77d06f4d78d10.tar.gz
nixpkgs-c99ea1c2039b57c20bf058184ee77d06f4d78d10.tar.bz2
nixpkgs-c99ea1c2039b57c20bf058184ee77d06f4d78d10.tar.lz
nixpkgs-c99ea1c2039b57c20bf058184ee77d06f4d78d10.tar.xz
nixpkgs-c99ea1c2039b57c20bf058184ee77d06f4d78d10.tar.zst
nixpkgs-c99ea1c2039b57c20bf058184ee77d06f4d78d10.zip
nixos/mailcatcher: add nixos test
Diffstat (limited to 'nixos/tests/mailcatcher.nix')
-rw-r--r--nixos/tests/mailcatcher.nix26
1 files changed, 26 insertions, 0 deletions
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;
+  '';
+})