aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-05-27 20:11:25 +0600
committerGitHub <noreply@github.com>2024-05-27 20:11:25 +0600
commit710b7b69b08a83c519db64ab94a6b7f8e7ec732c (patch)
treeb38e0875a4c48bddf1acde10c7ad4ba28d702d7d
parentf0c4d32740df0019673bc706c6004373a2a39220 (diff)
parent2cb5d3d1fe84ff5e1aace47cbd776369ff9258d4 (diff)
downloadrspamd-710b7b69b08a83c519db64ab94a6b7f8e7ec732c.tar.gz
rspamd-710b7b69b08a83c519db64ab94a6b7f8e7ec732c.zip
Merge pull request #4988 from fatalbanana/test4981
[Test] Test multimap regexp_multi map
-rw-r--r--test/functional/cases/001_merged/102_multimap.robot7
-rw-r--r--test/functional/configs/maps/words.list4
-rw-r--r--test/functional/configs/merged-override.conf6
-rw-r--r--test/functional/lib/rspamd.robot1
-rw-r--r--test/functional/messages/words.eml3
5 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/cases/001_merged/102_multimap.robot b/test/functional/cases/001_merged/102_multimap.robot
index 8e9d83d42..50d1af6b6 100644
--- a/test/functional/cases/001_merged/102_multimap.robot
+++ b/test/functional/cases/001_merged/102_multimap.robot
@@ -17,6 +17,7 @@ ${URL4} ${RSPAMD_TESTDIR}/messages/url4.eml
${URL5} ${RSPAMD_TESTDIR}/messages/url5.eml
${URL_ICS} ${RSPAMD_TESTDIR}/messages/ics.eml
${UTF_MESSAGE} ${RSPAMD_TESTDIR}/messages/utf.eml
+${WORDS_MESSAGE} ${RSPAMD_TESTDIR}/messages/words.eml
*** Test Cases ***
URL_ICS
@@ -434,3 +435,9 @@ MAP - DYNAMIC SYMBOLS - MISS
... Settings={symbols_enabled = [DYN_TEST1,DYN_TEST2,DYN_MULTIMAP]}
Do Not Expect Symbol DYN_TEST2
Do Not Expect Symbol DYN_TEST1
+
+REGEXP MULTI SCORES - ISSUE 4981
+ Scan File ${WORDS_MESSAGE}
+ ... Settings={symbols_enabled = [WORDTEST4981]}
+ Expect Symbol With Score WORDTEST4981 4
+ Expect Score 4
diff --git a/test/functional/configs/maps/words.list b/test/functional/configs/maps/words.list
new file mode 100644
index 000000000..4d28612e8
--- /dev/null
+++ b/test/functional/configs/maps/words.list
@@ -0,0 +1,4 @@
+/\bfoo\b/
+/\bbar\b/
+/\bbaz\b/
+/\bqux\b/
diff --git a/test/functional/configs/merged-override.conf b/test/functional/configs/merged-override.conf
index 35f22630f..5a1570767 100644
--- a/test/functional/configs/merged-override.conf
+++ b/test/functional/configs/merged-override.conf
@@ -38,6 +38,12 @@ antivirus {
}
multimap {
+ WORDTEST4981 {
+ type = "content";
+ filter = "text";
+ map = "regexp_multi;{= env.TESTDIR =}/configs/maps/words.list";
+ score = 1.0;
+ }
DNSBL_MAP {
type = "dnsbl";
map = "rspamd.com";
diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot
index f9614c6fa..254a6f3ca 100644
--- a/test/functional/lib/rspamd.robot
+++ b/test/functional/lib/rspamd.robot
@@ -90,6 +90,7 @@ Expect Required Score To Be Null
Expect Score
[Arguments] ${score}
Should Be Equal As Numbers ${SCAN_RESULT}[score] ${score}
+ ... msg="Expected message score of ${score} but got ${SCAN_RESULT}[score]"
Expect Symbol
[Arguments] ${symbol}
diff --git a/test/functional/messages/words.eml b/test/functional/messages/words.eml
new file mode 100644
index 000000000..d54d19321
--- /dev/null
+++ b/test/functional/messages/words.eml
@@ -0,0 +1,3 @@
+Content-type: text/plain
+
+lo foo bar baz qux bye