tests: test mailserver.loginAccounts.<name>.sieveScript

This commit is contained in:
emilylange
2026-04-12 04:07:01 +02:00
parent e33fbde199
commit 28bfef89ba
2 changed files with 26 additions and 1 deletions
+23 -1
View File
@@ -61,7 +61,7 @@ in
nodes = {
machine =
{ pkgs, ... }:
{ pkgs, lib, ... }:
{
imports = [
./../default.nix
@@ -111,6 +111,7 @@ in
};
"user3@example.com" = {
passwordFile = "/run/passwords/user3";
sieveScript = lib.readFile ./lib/redirect.sieve;
};
"user4@example.com" = {
hashedPasswordFile = hashedPasswordFileWithScheme;
@@ -292,6 +293,27 @@ in
)
)
with subtest("user's static Sieve script is being executed"):
# user3@example.com has a cfg.sieveScript that forwards every
# mail sent from user1@example.com back to user1@example.com
machine.succeed(
" ".join(
[
"mail-check send-and-read",
"--smtp-port 587",
"--smtp-starttls",
"--smtp-host localhost",
"--imap-host localhost",
"--imap-username user1@example.com",
"--from-addr user1@example.com",
"--to-addr user3@example.com",
"--src-password-file ${passwordFile}",
"--dst-password-file ${passwordFile}",
"--ignore-dkim-spf",
]
)
)
with subtest("imap port 143 is closed and imaps is serving SSL"):
machine.wait_for_closed_port(143)
machine.wait_for_open_port(993)