From 56e8ce00b9a63c0a0fa7b292d711fc21f6420e00 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 10 Aug 2025 18:34:36 +0200 Subject: [PATCH] tests: rspamd: Fix sieve tests Currently, the sieve tests only check whether the sieve scripts were invoked. However, they could still fail due to wrong permissions, etc. This commit enables additional logging output for dovecot2 and refines the sieve tests to check for error messages. --- tests/common/server.nix | 9 ++++++++- tests/rspamd.nix | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/common/server.nix b/tests/common/server.nix index ff60d5d..34476df 100644 --- a/tests/common/server.nix +++ b/tests/common/server.nix @@ -1,4 +1,4 @@ -{...}: { +{lib, ...}: { imports = [./../../mailsystem]; config = { virtualisation.memorySize = 1024; @@ -6,5 +6,12 @@ enable = true; certificateScheme = "selfsigned"; }; + + # Enable more verbose logging (required for, e.g., sieve testing) + services.dovecot2.extraConfig = lib.mkAfter '' + mail_debug = yes + auth_debug = yes + verbose_ssl = yes + ''; }; } diff --git a/tests/rspamd.nix b/tests/rspamd.nix index ef8e6ea..eb71ed6 100644 --- a/tests/rspamd.nix +++ b/tests/rspamd.nix @@ -152,8 +152,11 @@ in client.succeed("${test-mark-spam "normal2"} >&2") server.wait_until_succeeds("journalctl -u dovecot2 | grep -i learn-spam.sh >&2") + server.fail("journalctl -u dovecot2 | grep -i learn-spam.sh | grep -i error >&2") + client.succeed("${test-mark-ham "normal2"} >&2") server.wait_until_succeeds("journalctl -u dovecot2 | grep -i learn-ham.sh >&2") + server.fail("journalctl -u dovecot2 | grep -i learn-ham.sh | grep -i error >&2") with subtest("dkim signing"): client.succeed("${sendMail "normal2" "" accounts."normal".address ''