Merge branch 'fast-tests' into 'master'

📉 Make tests fast

See merge request simple-nixos-mailserver/nixos-mailserver!419
This commit is contained in:
Martin Weinelt 2025-06-18 00:01:53 +00:00
commit 217ec6008a
5 changed files with 48 additions and 11 deletions

View file

@ -1026,14 +1026,34 @@ in
};
};
debug = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable verbose logging for mailserver related services. This
intended be used for development purposes only, you probably don't want
to enable this unless you're hacking on nixos-mailserver.
'';
debug = {
all = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable verbose logging for all mailserver related services.
This intended be used for development purposes only, you probably
don't want to enable this unless you're hacking on nixos-mailserver.
'';
};
dovecot = mkOption {
type = types.bool;
default = cfg.debug.all;
defaultText = lib.literalExpression "config.mailserver.debug.all";
description = ''
Whether to enable verbose logging for Dovecot.
'';
};
rspamd = mkOption {
type = types.bool;
default = cfg.debug.all;
defaultText = lib.literalExpression "config.mailserver.debug.all";
description = ''
Whether to enable verbose logging for Rspamd.
'';
};
};
maxConnectionsPerUser = mkOption {

View file

@ -262,7 +262,7 @@ in
extraConfig = ''
#Extra Config
${lib.optionalString cfg.debug ''
${lib.optionalString cfg.debug.dovecot ''
mail_debug = yes
auth_debug = yes
verbose_ssl = yes

View file

@ -67,7 +67,7 @@ in
services.rspamd = {
enable = true;
inherit (cfg) debug;
debug = cfg.debug.rspamd;
locals = {
"milter_headers.conf" = {
text = ''

View file

@ -39,7 +39,7 @@
mailserver = {
enable = true;
debug = true;
debug.dovecot = true; # enabled for sieve script logging
fqdn = "mail.example.com";
domains = [
"example.com"

View file

@ -1,4 +1,21 @@
{
lib,
...
}:
{
# Testing eval failures that result from stateVersion assertion is out of scope
mailserver.stateVersion = 999;
# Enable second CPU core
virtualisation.cores = lib.mkDefault 2;
# Don't make tests block on DNS requests that will never succeed
services.rspamd.locals."options.inc".text = ''
dns {
nameservers = ["127.0.0.1"];
timeout = 0.0s;
retransmits = 0;
}
'';
}