diff options
author | Johannes Schleifenbaum <johannes@js-webcoding.de> | 2020-12-17 16:58:57 +0100 |
---|---|---|
committer | Johannes Schleifenbaum <johannes@js-webcoding.de> | 2020-12-17 16:58:57 +0100 |
commit | df7a435e3e3d76a052dd592213dc6932e1faa712 (patch) | |
tree | e43030f158fb50094f1769b564a44d394bbbfdef | |
parent | d0ec6db7ce11419171740f5299516d241484ea3f (diff) |
mailhog: add simple test
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/mailhog.nix | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 0c06e3f44249..e770c8763d83 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -210,6 +210,7 @@ in magic-wormhole-mailbox-server = handleTest ./magic-wormhole-mailbox-server.nix {}; magnetico = handleTest ./magnetico.nix {}; mailcatcher = handleTest ./mailcatcher.nix {}; + mailhog = handleTest ./mailhog.nix {}; mariadb-galera-mariabackup = handleTest ./mysql/mariadb-galera-mariabackup.nix {}; mariadb-galera-rsync = handleTest ./mysql/mariadb-galera-rsync.nix {}; matomo = handleTest ./matomo.nix {}; 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" + ) + ''; +}) |