aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-20 17:38:47 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-20 17:38:47 +0100
commit86bab0cc08c90f2c1a17c3c9addedc889a0500aa (patch)
treef389b6e9f56a2caaaecab94db706f5dc2adc67ef /test/functional
parentd79e398a8b089c3268f4aaf3aff12fea888d5264 (diff)
downloadrspamd-86bab0cc08c90f2c1a17c3c9addedc889a0500aa.tar.gz
rspamd-86bab0cc08c90f2c1a17c3c9addedc889a0500aa.zip
[Test] Add tests for IDs propagation
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/cases/108_settings.robot21
-rw-r--r--test/functional/configs/settings.conf9
-rw-r--r--test/functional/lua/settings.lua18
3 files changed, 48 insertions, 0 deletions
diff --git a/test/functional/cases/108_settings.robot b/test/functional/cases/108_settings.robot
index 31d04fa1e..b7c75af03 100644
--- a/test/functional/cases/108_settings.robot
+++ b/test/functional/cases/108_settings.robot
@@ -110,6 +110,7 @@ SETTINGS ID - VIRTUAL
Check Rspamc ${result} SIMPLE_VIRTUAL
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -119,6 +120,7 @@ SETTINGS ID - VIRTUAL GROUP
Should Contain ${result.stdout} EXPLICIT_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -128,6 +130,7 @@ SETTINGS ID - VIRTUAL FROM
Should Contain ${result.stdout} EXPLICIT_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -137,6 +140,7 @@ SETTINGS ID - VIRTUAL USER
Should Contain ${result.stdout} EXPLICIT_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -146,6 +150,7 @@ SETTINGS ID - VIRTUAL HOSTNAME
Should Contain ${result.stdout} EXPLICIT_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -155,6 +160,7 @@ SETTINGS ID - VIRTUAL SELECTOR
Should Contain ${result.stdout} EXPLICIT_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -164,6 +170,7 @@ SETTINGS ID - ANGLED RECIPIENT
Should Contain ${result.stdout} EXPLICIT_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -173,6 +180,7 @@ SETTINGS ID - VIRTUAL HEADER MATCH
Should Contain ${result.stdout} EXPLICIT_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -181,6 +189,7 @@ SETTINGS ID - VIRTUAL HEADER EXISTS
Check Rspamc ${result} SIMPLE_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -189,6 +198,7 @@ SETTINGS ID - VIRTUAL HEADER ABSENT
Check Rspamc ${result} SIMPLE_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
@@ -197,6 +207,17 @@ SETTINGS ID - VIRTUAL REQUEST HEADER
Check Rspamc ${result} SIMPLE_VIRTUAL (10
Should Not Contain ${result.stdout} SIMPLE_TEST
Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1
+ Should Not Contain ${result.stdout} DEP_REAL
+ Should Not Contain ${result.stdout} SIMPLE_POST
+ Should Not Contain ${result.stdout} SIMPLE_PRE
+
+SETTINGS ID - VIRTUAL DEP
+ ${result} = Scan Message With Rspamc ${MESSAGE} --header Settings-Id=id_virtual1
+ Check Rspamc ${result} EXPLICIT_VIRTUAL1
+ Should Contain ${result.stdout} DEP_VIRTUAL
+ Should Contain ${result.stdout} DEP_REAL
+ Should Not Contain ${result.stdout} SIMPLE_TEST
+ Should Not Contain ${result.stdout} SIMPLE_VIRTUAL
Should Not Contain ${result.stdout} SIMPLE_POST
Should Not Contain ${result.stdout} SIMPLE_PRE
diff --git a/test/functional/configs/settings.conf b/test/functional/configs/settings.conf
index 34b7613b8..0ba4de1c6 100644
--- a/test/functional/configs/settings.conf
+++ b/test/functional/configs/settings.conf
@@ -20,6 +20,15 @@ settings {
}
}
+ id_virtual1 {
+ apply {
+ symbols {
+ EXPLICIT_VIRTUAL1 = 10.0
+ }
+ symbols_enabled = ["DEP_REAL"];
+ }
+ }
+
id_virtual_group {
user = "test@example.com";
from = "test2@example.com";
diff --git a/test/functional/lua/settings.lua b/test/functional/lua/settings.lua
index d0f496c68..e072af62c 100644
--- a/test/functional/lua/settings.lua
+++ b/test/functional/lua/settings.lua
@@ -47,3 +47,21 @@ rspamd_config:register_symbol({
group = 'vg',
parent = id,
})
+
+id = rspamd_config:register_symbol({
+ name = 'DEP_REAL',
+ callback = function(task)
+ task:insert_result('DEP_VIRTUAL', 1.0)
+ return true
+ end,
+ score = 1.0,
+})
+
+rspamd_config:register_symbol({
+ name = 'DEP_VIRTUAL',
+ parent = id,
+ type = 'virtual',
+ score = 1.0,
+})
+
+rspamd_config:register_dependency('DEP_VIRTUAL', 'EXPLICIT_VIRTUAL1') \ No newline at end of file