depot/third_party/nixpkgs/nixos/tests/mailhog.nix
Default email b6d97fd731 Project import generated by Copybara.
GitOrigin-RevId: be0b453d7c7eee2090962c9a83749b024ff9acf5
2020-12-25 14:55:36 +01:00

24 lines
684 B
Nix

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"
)
'';
})