summaryrefslogtreecommitdiffstats
path: root/nixos/tests/mailhog.nix
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2020-12-17 20:23:28 +0200
committerGitHub <noreply@github.com>2020-12-17 20:23:28 +0200
commitdd896050505420f9e4b509c7e744d0f1a5000c30 (patch)
treeb7ab2c684ffe55d57d1d62d17ed0e9ef398e5fb3 /nixos/tests/mailhog.nix
parentf5944b74e670cac2746edaee609c9f31d816bcbd (diff)
parentdf7a435e3e3d76a052dd592213dc6932e1faa712 (diff)
Merge pull request #97445 from jojosch/mailhog-1.0.1
Diffstat (limited to 'nixos/tests/mailhog.nix')
-rw-r--r--nixos/tests/mailhog.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/nixos/tests/mailhog.nix b/nixos/tests/mailhog.nix
new file mode 100644
index 000000000000..aece57178dd1
--- /dev/null
+++ b/nixos/tests/mailhog.nix
@@ -0,0 +1,24 @@
+import ./make-test-python.nix ({ lib, ... }: {
+ name = "mailhog";
+ meta.maintainers = with lib.maintainers; [ jojosch ];
+
+ machine = { pkgs, ... }: {
+ services.mailhog.enable = true;
+
+ environment.systemPackages = with pkgs; [ swaks ];
+ };
+
+ testScript = ''
+ start_all()
+
+ machine.wait_for_unit("mailhog.service")
+ machine.wait_for_open_port("1025")
+ machine.wait_for_open_port("8025")
+ machine.succeed(
+ 'echo "this is the body of the email" | swaks --to root@example.org --body - --server localhost:1025'
+ )
+ assert "this is the body of the email" in machine.succeed(
+ "curl --fail http://localhost:8025/api/v2/messages"
+ )
+ '';
+})