nixosTests.mailcatcher: migrate to runTest

Part of #386873
This commit is contained in:
Piotr Kwiecinski 2025-03-30 01:24:16 +01:00
parent 1c2f1b30b5
commit 1004fff704
No known key found for this signature in database
GPG key ID: EC0DE1CB9D5258B4
2 changed files with 29 additions and 31 deletions

View file

@ -678,7 +678,7 @@ in {
maestral = handleTest ./maestral.nix {};
magic-wormhole-mailbox-server = handleTest ./magic-wormhole-mailbox-server.nix {};
magnetico = handleTest ./magnetico.nix {};
mailcatcher = handleTest ./mailcatcher.nix {};
mailcatcher = runTest ./mailcatcher.nix;
mailhog = handleTest ./mailhog.nix {};
mailpit = handleTest ./mailpit.nix {};
mailman = handleTest ./mailman.nix {};

View file

@ -1,37 +1,35 @@
import ./make-test-python.nix (
{ lib, ... }:
{ lib, ... }:
{
name = "mailcatcher";
meta.maintainers = [ lib.maintainers.aanderse ];
{
name = "mailcatcher";
meta.maintainers = [ lib.maintainers.aanderse ];
nodes.machine =
{ pkgs, ... }:
{
services.mailcatcher.enable = true;
nodes.machine =
{ pkgs, ... }:
{
services.mailcatcher.enable = true;
programs.msmtp = {
enable = true;
accounts.default = {
host = "localhost";
port = 1025;
};
programs.msmtp = {
enable = true;
accounts.default = {
host = "localhost";
port = 1025;
};
environment.systemPackages = [ pkgs.mailutils ];
};
testScript = ''
start_all()
environment.systemPackages = [ pkgs.mailutils ];
};
machine.wait_for_unit("mailcatcher.service")
machine.wait_for_open_port(1025)
machine.succeed(
'echo "this is the body of the email" | mail -s "subject" root@example.org'
)
assert "this is the body of the email" in machine.succeed(
"curl -f http://localhost:1080/messages/1.source"
)
'';
}
)
testScript = ''
start_all()
machine.wait_for_unit("mailcatcher.service")
machine.wait_for_open_port(1025)
machine.succeed(
'echo "this is the body of the email" | mail -s "subject" root@example.org'
)
assert "this is the body of the email" in machine.succeed(
"curl -f http://localhost:1080/messages/1.source"
)
'';
}