]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Test multimap regexp_multi map 4988/head
authorAndrew Lewis <nerf@judo.za.org>
Mon, 27 May 2024 11:06:25 +0000 (13:06 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 27 May 2024 11:30:39 +0000 (13:30 +0200)
test/functional/cases/001_merged/102_multimap.robot
test/functional/configs/maps/words.list [new file with mode: 0644]
test/functional/configs/merged-override.conf
test/functional/lib/rspamd.robot
test/functional/messages/words.eml [new file with mode: 0644]

index 8e9d83d42c569a2ad2c17fb35cb6e26b9749cb73..50d1af6b6ddc406062bdb29be598543daa200db4 100644 (file)
@@ -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 (file)
index 0000000..4d28612
--- /dev/null
@@ -0,0 +1,4 @@
+/\bfoo\b/
+/\bbar\b/
+/\bbaz\b/
+/\bqux\b/
index 35f22630fc3e90bf77091cc210ecdc6cd9d0a5cc..5a15707679aad257514a39eeecc0f39d3aa3e360 100644 (file)
@@ -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";
index f9614c6fa0b7797c5f845c0a3f5d1b16e4d5fdaf..254a6f3caab06bb92b8fc05ec5500b6c82393c2a 100644 (file)
@@ -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 (file)
index 0000000..d54d193
--- /dev/null
@@ -0,0 +1,3 @@
+Content-type: text/plain\r
+\r
+lo foo bar baz qux bye\r