From: Vsevolod Stakhov Date: Thu, 24 Jan 2019 13:37:06 +0000 (+0000) Subject: [Test] Add testing for dynamic conf X-Git-Tag: 1.9.0~260 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b29c55a1945c81036a02c62d0329a63877ac73b4;p=rspamd.git [Test] Add testing for dynamic conf --- diff --git a/test/functional/cases/280_rules.robot b/test/functional/cases/280_rules.robot index bb2012237..d66ecf5d4 100644 --- a/test/functional/cases/280_rules.robot +++ b/test/functional/cases/280_rules.robot @@ -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 index 000000000..b76664439 --- /dev/null +++ b/test/functional/configs/dynamic.conf @@ -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 diff --git a/test/functional/configs/regexp.conf b/test/functional/configs/regexp.conf index ddf780ed1..381fa0ea4 100644 --- a/test/functional/configs/regexp.conf +++ b/test/functional/configs/regexp.conf @@ -49,4 +49,8 @@ regexp { } } +options { + dynamic_conf = "${TESTDIR}/configs/dynamic.conf"; +} + lua = "${TESTDIR}/lua/regex_test.lua"