aboutsummaryrefslogtreecommitdiff
path: root/nixos/tests/rspamd.nix
diff options
context:
space:
mode:
authorBrian Olsen <brian@maven-group.org>2018-11-05 17:50:34 +0100
committerBrian Olsen <brian@maven-group.org>2018-11-05 17:50:34 +0100
commitc853b3482455fccd949b5fd0bc16b44f8bc72f23 (patch)
tree89c6c8e72089749abba2b696bc4bbac4f1b5a1a3 /nixos/tests/rspamd.nix
parent5c63ee6216a78d8d99300cdc52adb2207337780f (diff)
nixos/rspamd: Fix enable for locals and overrides
When implementing #49620 I included an enable option for both the locals and overrides options but the code writing the files didn't actually look at enable and so would write the file regardless of its value. I also set the type to loaOf which should have been attrsOf since the code was not written to handle the options being lists. This fixes both of those issues.
Diffstat (limited to 'nixos/tests/rspamd.nix')
-rw-r--r--nixos/tests/rspamd.nix37
1 files changed, 29 insertions, 8 deletions
diff --git a/nixos/tests/rspamd.nix b/nixos/tests/rspamd.nix
index af765f37b91b..a744760412d5 100644
--- a/nixos/tests/rspamd.nix
+++ b/nixos/tests/rspamd.nix
@@ -110,16 +110,33 @@ in
'';
services.rspamd = {
enable = true;
- locals."groups.conf".text = ''
- group "cows" {
- symbol {
- NO_MUH = {
- weight = 1.0;
- description = "Mails should not muh";
+ locals = {
+ "antivirus.conf" = mkIf false { text = ''
+ clamav {
+ action = "reject";
+ symbol = "CLAM_VIRUS";
+ type = "clamav";
+ log_clean = true;
+ servers = "/run/clamav/clamd.ctl";
+ }
+ '';};
+ "redis.conf" = {
+ enable = false;
+ text = ''
+ servers = "127.0.0.1";
+ '';
+ };
+ "groups.conf".text = ''
+ group "cows" {
+ symbol {
+ NO_MUH = {
+ weight = 1.0;
+ description = "Mails should not muh";
+ }
}
}
- }
- '';
+ '';
+ };
localLuaRules = pkgs.writeText "rspamd.local.lua" ''
local rspamd_logger = require "rspamd_logger"
rspamd_config.NO_MUH = {
@@ -152,6 +169,10 @@ in
$machine->log($machine->succeed("cat /etc/rspamd/rspamd.conf"));
$machine->log($machine->succeed("cat /etc/rspamd/rspamd.local.lua"));
$machine->log($machine->succeed("cat /etc/rspamd/local.d/groups.conf"));
+ # Verify that redis.conf was not written
+ $machine->fail("cat /etc/rspamd/local.d/redis.conf >&2");
+ # Verify that antivirus.conf was not written
+ $machine->fail("cat /etc/rspamd/local.d/antivirus.conf >&2");
${checkSocket "/run/rspamd/rspamd.sock" "rspamd" "rspamd" "660" }
$machine->log($machine->succeed("curl --unix-socket /run/rspamd/rspamd.sock http://localhost/ping"));
$machine->log($machine->succeed("rspamc -h 127.0.0.1:11334 stat"));