]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Add testing for dynamic conf
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 24 Jan 2019 13:37:06 +0000 (13:37 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 24 Jan 2019 13:37:06 +0000 (13:37 +0000)
test/functional/cases/280_rules.robot
test/functional/configs/dynamic.conf [new file with mode: 0644]
test/functional/configs/regexp.conf

index bb201223765c4002320fd49692bd6776a8f1e38d..d66ecf5d47644edadd5b4c85d6fb3707a5f89c11 100644 (file)
@@ -6,12 +6,13 @@ Resource        ${TESTDIR}/lib/rspamd.robot
 Variables       ${TESTDIR}/lib/vars.py
 
 *** Variables ***
-${CONFIG}       ${TESTDIR}/configs/plugins.conf
+${CONFIG}        ${TESTDIR}/configs/plugins.conf
+${MESSAGE}       ${TESTDIR}/messages/newlines.eml
 ${MESSAGE1}      ${TESTDIR}/messages/fws_fn.eml
 ${MESSAGE2}      ${TESTDIR}/messages/fws_fp.eml
 ${MESSAGE3}      ${TESTDIR}/messages/fws_tp.eml
 ${MESSAGE4}      ${TESTDIR}/messages/broken_richtext.eml
-${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat
+${URL_TLD}       ${TESTDIR}/../lua/unit/test_tld.dat
 ${RSPAMD_SCOPE}  Test
 
 
@@ -34,6 +35,11 @@ Broken Rich Text
   ${result} =  Scan Message With Rspamc  ${MESSAGE4}
   Check Rspamc  ${result}  BROKEN_CONTENT_TYPE
 
+Dynamic Config
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  Check Rspamc  ${result}  SA_BODY_WORD (10
+  Check Rspamc  ${result}  \/ 20
+
 *** Keywords ***
 Rules Setup
   ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/regexp.conf
diff --git a/test/functional/configs/dynamic.conf b/test/functional/configs/dynamic.conf
new file mode 100644 (file)
index 0000000..b766644
--- /dev/null
@@ -0,0 +1,117 @@
+[
+    {
+        "metric": "default",
+        "actions": [
+            {
+                "name": "reject",
+                "value": 20.0
+            },
+            {
+                "name": "add header",
+                "value": 6.0
+            }
+        ],
+        "symbols": [
+            {
+                "name": "SA_BODY_WORD",
+                "value": 10.0
+            },
+            {
+                "name": "FORGED_RECIPIENTS",
+                "value": 0.0
+            },
+            {
+                "name": "PHISHING",
+                "value": 0.0
+            },
+            {
+                "name": "PRECEDENCE_BULK",
+                "value": 2.0
+            },
+            {
+                "name": "SPAM_FLAG",
+                "value": 6.0
+            },
+            {
+                "name": "BAYES_SPAM",
+                "value": 10.0
+            },
+            {
+                "name": "BAYES_HAM",
+                "value": -6.0
+            },
+            {
+                "name": "MISSING_TO",
+                "value": 3.0
+            },
+            {
+                "name": "FUZZY_DENIED",
+                "value": 0.0
+            },
+            {
+                "name": "DMARC_POLICY_QUARANTINE",
+                "value": 3.500000
+            },
+            {
+                "name": "DMARC_POLICY_SOFTFAIL",
+                "value": 2.0
+            },
+            {
+                "name": "DNSWL_BLOCKED",
+                "value": 1.0
+            },
+            {
+                "name": "RCVD_COUNT_TWO",
+                "value": 1.0
+            },
+            {
+                "name": "R_SPF_FAIL",
+                "value": 10.0
+            },
+            {
+                "name": "R_DKIM_ALLOW",
+                "value": -1.500000
+            },
+            {
+                "name": "FAKE_REPLY",
+                "value": 2.0
+            },
+            {
+                "name": "SUBJECT_ENDS_EXCLAIM",
+                "value": 2.0
+            },
+            {
+                "name": "FORGED_SENDER_MAILLIST",
+                "value": 1.0
+            },
+            {
+                "name": "RCVD_NO_TLS_LAST",
+                "value": 1.0
+            },
+            {
+                "name": "HFILTER_URL_ONLY",
+                "value": 4.200000
+            },
+            {
+                "name": "URI_COUNT_ODD",
+                "value": 2.0
+            },
+            {
+                "name": "FORGED_RECIPIENTS_MAILLIST",
+                "value": 1.0
+            },
+            {
+                "name": "SEM_URIBL_FRESH15",
+                "value": 4.0
+            },
+            {
+                "name": "FROM_NEQ_ENVFROM",
+                "value": 1.0
+            },
+            {
+                "name": "DMARC_POLICY_REJECT",
+                "value": 3.0
+            }
+        ]
+    }
+]
\ No newline at end of file
index ddf780ed179bcfd35f67ae01baeee6f62c6f50aa..381fa0ea46af78d41fcb2fa65ed8229519c67a02 100644 (file)
@@ -49,4 +49,8 @@ regexp {
   }
 }
 
+options {
+  dynamic_conf = "${TESTDIR}/configs/dynamic.conf";
+}
+
 lua = "${TESTDIR}/lua/regex_test.lua"