Browse Source

[Test] Add tests for IDs propagation

tags/2.0
Vsevolod Stakhov 4 years ago
parent
commit
86bab0cc08

+ 21
- 0
test/functional/cases/108_settings.robot View File

@@ -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


+ 9
- 0
test/functional/configs/settings.conf View File

@@ -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";

+ 18
- 0
test/functional/lua/settings.lua View File

@@ -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')

Loading…
Cancel
Save