From 1004fff7042306a69b2ad6c20e8df6369535f619 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski <2151333+piotrkwiecinski@users.noreply.github.com> Date: Sun, 30 Mar 2025 01:24:16 +0100 Subject: [PATCH] nixosTests.mailcatcher: migrate to runTest Part of #386873 --- nixos/tests/all-tests.nix | 2 +- nixos/tests/mailcatcher.nix | 58 ++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index f459cf4611d2..69f8f364c089 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -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 {}; diff --git a/nixos/tests/mailcatcher.nix b/nixos/tests/mailcatcher.nix index 312f8ed102bf..376b739abd03 100644 --- a/nixos/tests/mailcatcher.nix +++ b/nixos/tests/mailcatcher.nix @@ -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" + ) + ''; +}