nixosTests.mailcatcher: migrate to runTest

Part of #386873

Changed files
+29 -31
nixos
+1 -1
nixos/tests/all-tests.nix
···
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 {};
+28 -30
nixos/tests/mailcatcher.nix
···
-
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 ];
+
};
+
+
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"
-
)
-
'';
-
}
-
)
+
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"
+
)
+
'';
+
}