diff options
Diffstat (limited to 'test')
126 files changed, 1420 insertions, 1733 deletions
diff --git a/test/functional/cases/100_general.robot b/test/functional/cases/100_general.robot index 0a754a973..e76b07c54 100644 --- a/test/functional/cases/100_general.robot +++ b/test/functional/cases/100_general.robot @@ -1,15 +1,15 @@ *** Settings *** -Suite Setup Generic Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/trivial.conf -${GTUBE} ${TESTDIR}/messages/gtube.eml -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/trivial.conf +${GTUBE} ${RSPAMD_TESTDIR}/messages/gtube.eml +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** GTUBE @@ -17,7 +17,7 @@ GTUBE Expect Symbol GTUBE GTUBE - Encrypted - ${result} = Run Rspamc -p -h ${LOCAL_ADDR}:${PORT_NORMAL} --key ${KEY_PUB1} + ${result} = Run Rspamc -p -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_NORMAL} --key ${RSPAMD_KEY_PUB1} ... ${GTUBE} Check Rspamc ${result} GTUBE ( @@ -31,20 +31,20 @@ GTUBE - Scan File feature (encoded) Expect Symbol GTUBE GTUBE - SPAMC - ${result} = Spamc ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE} + ${result} = Spamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} ${GTUBE} Should Contain ${result} GTUBE GTUBE - RSPAMC - ${result} = Rspamc ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE} + ${result} = Rspamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} ${GTUBE} Should Contain ${result} GTUBE EMAILS DETECTION 1 - Scan File ${TESTDIR}/messages/emails1.eml URL-Format=Extended + Scan File ${RSPAMD_TESTDIR}/messages/emails1.eml URL-Format=Extended Expect Email jim@example.net Expect Email bob@example.net Expect Email rupert@example.net EMAILS DETECTION ZEROFONT - Scan File ${TESTDIR}/messages/zerofont.eml + Scan File ${RSPAMD_TESTDIR}/messages/zerofont.eml Expect Symbol MANY_INVISIBLE_PARTS Expect Symbol ZERO_FONT diff --git a/test/functional/cases/101_lua.robot b/test/functional/cases/101_lua.robot index 215ecd086..67e0d35ec 100644 --- a/test/functional/cases/101_lua.robot +++ b/test/functional/cases/101_lua.robot @@ -1,53 +1,53 @@ *** Settings *** -Test Teardown Normal Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Test Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/lua_test.conf -${MAP_MAP} ${TESTDIR}/configs/maps/map.list -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RADIX_MAP} ${TESTDIR}/configs/maps/ip2.list -${REGEXP_MAP} ${TESTDIR}/configs/maps/regexp.list -${RSPAMD_SCOPE} Test -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf +${MAP_MAP} ${RSPAMD_TESTDIR}/configs/maps/map.list +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RADIX_MAP} ${RSPAMD_TESTDIR}/configs/maps/ip2.list +${REGEXP_MAP} ${RSPAMD_TESTDIR}/configs/maps/regexp.list +${RSPAMD_SCOPE} Test +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Flags - [Setup] Lua Setup ${TESTDIR}/lua/flags.lua + [Setup] Lua Setup ${RSPAMD_TESTDIR}/lua/flags.lua Scan File ${MESSAGE} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} stat + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} stat Should Contain ${result.stdout} Messages scanned: 0 Dependencies - [Setup] Lua Setup ${TESTDIR}/lua/deps.lua + [Setup] Lua Setup ${RSPAMD_TESTDIR}/lua/deps.lua Scan File ${MESSAGE} Expect Symbol DEP10 Pre and Post Filters - [Setup] Lua Setup ${TESTDIR}/lua/prepostfilters.lua + [Setup] Lua Setup ${RSPAMD_TESTDIR}/lua/prepostfilters.lua Scan File ${MESSAGE} Expect Symbol TEST_PRE Expect Symbol TEST_POST Recipient Parsing Sanity - [Setup] Lua Setup ${TESTDIR}/lua/recipients.lua + [Setup] Lua Setup ${RSPAMD_TESTDIR}/lua/recipients.lua Scan File ${MESSAGE} Rcpt=rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar Expect Symbol With Exact Options TEST_RCPT rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar TLD parts - [Setup] TLD Setup ${TESTDIR}/lua/tlds.lua + [Setup] TLD Setup ${RSPAMD_TESTDIR}/lua/tlds.lua Scan File ${MESSAGE} Expect Symbol With Exact Options TEST_TLD no worry Hashes - [Setup] Lua Setup ${TESTDIR}/lua/hashes.lua + [Setup] Lua Setup ${RSPAMD_TESTDIR}/lua/hashes.lua Scan File ${MESSAGE} Expect Symbol With Exact Options TEST_HASHES no worry Maps Key Values - [Setup] Lua Replace Setup ${TESTDIR}/lua/maps_kv.lua + [Setup] Lua Replace Setup ${RSPAMD_TESTDIR}/lua/maps_kv.lua [Teardown] Lua Replace Teardown Scan File ${MESSAGE} Expect Symbol With Exact Options RADIX_KV no worry @@ -55,14 +55,14 @@ Maps Key Values Expect Symbol With Exact Options MAP_KV no worry Option Order - [Setup] Lua Replace Setup ${TESTDIR}/lua/option_order.lua + [Setup] Lua Replace Setup ${RSPAMD_TESTDIR}/lua/option_order.lua [Teardown] Lua Replace Teardown Scan File ${MESSAGE} Expect Symbol With Exact Options OPTION_ORDER one two three 4 5 a Expect Symbol With Exact Options TBL_OPTION_ORDER one two three 4 5 a Rule conditions - [Setup] Lua Replace Setup ${TESTDIR}/lua/conditions.lua + [Setup] Lua Replace Setup ${RSPAMD_TESTDIR}/lua/conditions.lua [Teardown] Lua Replace Teardown Scan File ${MESSAGE} Expect Symbol With Option ANY_A hello3 @@ -71,23 +71,23 @@ Rule conditions *** Keywords *** Lua Setup - [Arguments] ${LUA_SCRIPT} - Set Test Variable ${LUA_SCRIPT} - Generic Setup + [Arguments] ${RSPAMD_LUA_SCRIPT} + Set Test Variable ${RSPAMD_LUA_SCRIPT} + Rspamd Setup Lua Replace Setup [Arguments] ${LUA_SCRIPT_UNESC} - ${LUA_SCRIPT} = Make Temporary File + ${RSPAMD_LUA_SCRIPT} = Make Temporary File ${lua} = Get File ${LUA_SCRIPT_UNESC} ${lua} = Replace Variables ${lua} - Create File ${LUA_SCRIPT} ${lua} - Lua Setup ${LUA_SCRIPT} + Create File ${RSPAMD_LUA_SCRIPT} ${lua} + Lua Setup ${RSPAMD_LUA_SCRIPT} Lua Replace Teardown - Remove File ${LUA_SCRIPT} - Normal Teardown + Remove File ${RSPAMD_LUA_SCRIPT} + Rspamd Teardown TLD Setup - [Arguments] ${LUA_SCRIPT} - Set Test Variable ${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat - Lua Setup ${LUA_SCRIPT} + [Arguments] ${RSPAMD_LUA_SCRIPT} + Set Test Variable ${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat + Lua Setup ${RSPAMD_LUA_SCRIPT} diff --git a/test/functional/cases/102_multimap.robot b/test/functional/cases/102_multimap.robot index fc93d7565..8085ad748 100644 --- a/test/functional/cases/102_multimap.robot +++ b/test/functional/cases/102_multimap.robot @@ -1,28 +1,28 @@ *** Settings *** -Suite Setup Multimap Setup -Suite Teardown Multimap Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Redis Setup +Suite Teardown Rspamd Redis Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${UTF_MESSAGE} ${TESTDIR}/messages/utf.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${RCVD1} ${TESTDIR}/messages/received1.eml -${RCVD2} ${TESTDIR}/messages/received2.eml -${RCVD3} ${TESTDIR}/messages/received3.eml -${RCVD4} ${TESTDIR}/messages/received4.eml -${URL1} ${TESTDIR}/messages/url1.eml -${URL2} ${TESTDIR}/messages/url2.eml -${URL3} ${TESTDIR}/messages/url3.eml -${URL4} ${TESTDIR}/messages/url4.eml -${URL5} ${TESTDIR}/messages/url5.eml -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${FREEMAIL_CC} ${TESTDIR}/messages/freemailcc.eml -${URL_ICS} ${TESTDIR}/messages/ics.eml +${CONFIG} ${RSPAMD_TESTDIR}/configs/multimap.conf +${FREEMAIL_CC} ${RSPAMD_TESTDIR}/messages/freemailcc.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RCVD1} ${RSPAMD_TESTDIR}/messages/received1.eml +${RCVD2} ${RSPAMD_TESTDIR}/messages/received2.eml +${RCVD3} ${RSPAMD_TESTDIR}/messages/received3.eml +${RCVD4} ${RSPAMD_TESTDIR}/messages/received4.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat +${URL1} ${RSPAMD_TESTDIR}/messages/url1.eml +${URL2} ${RSPAMD_TESTDIR}/messages/url2.eml +${URL3} ${RSPAMD_TESTDIR}/messages/url3.eml +${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 *** Test Cases *** URL_ICS @@ -335,14 +335,3 @@ FREEMAIL_CC MAP - MULTISYMBOL DISABLED Scan File ${MESSAGE} Rcpt=user3@example.com Expect Symbol With Exact Options RCPT_MAP_NOMULTISYM user3@example.com SYM1 - -*** Keywords *** -Multimap Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/multimap.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - Run Redis - -Multimap Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} diff --git a/test/functional/cases/103_password.robot b/test/functional/cases/103_password.robot index c750369bf..a8dade884 100644 --- a/test/functional/cases/103_password.robot +++ b/test/functional/cases/103_password.robot @@ -1,55 +1,55 @@ *** Settings *** -Test Teardown Normal Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Test Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/password.conf -${CONTROLLER_ERRORS} False -${RSPAMD_SCOPE} Test -${PBKDF_PASSWORD} "$1$rhzzahtm8a5homdhh7z4qiiy7j8pzp4u$k5toro136brshjjuy9t39r785td69qodmd39qzygxuyehn9tqauy" -${CATENA_PASSWORD} "$2$xu1581gidj5cyp4yjgo68qbj6jz1j8o3$j9yg4k58jy3fj8suijxx9d7pea6a6obtufq9kfenosyq8erm87ky" +${CONFIG} ${RSPAMD_TESTDIR}/configs/password.conf +${CONTROLLER_ERRORS} False +${RSPAMD_CATENA_PASSWORD} "$2$xu1581gidj5cyp4yjgo68qbj6jz1j8o3$j9yg4k58jy3fj8suijxx9d7pea6a6obtufq9kfenosyq8erm87ky" +${RSPAMD_PBKDF_PASSWORD} "$1$rhzzahtm8a5homdhh7z4qiiy7j8pzp4u$k5toro136brshjjuy9t39r785td69qodmd39qzygxuyehn9tqauy" +${RSPAMD_SCOPE} Test *** Test Cases *** PASSWORD - PBKDF - [Setup] Password Setup ${PBKDF_PASSWORD} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P nq1 stat + [Setup] Password Setup ${RSPAMD_PBKDF_PASSWORD} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -P nq1 stat Check Rspamc ${result} Messages scanned: PASSWORD - PBKDF WRONG - [Setup] Password Setup ${PBKDF_PASSWORD} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q1q1 stat + [Setup] Password Setup ${RSPAMD_PBKDF_PASSWORD} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -P q1q1 stat Should Be Equal As Integers ${result.rc} 1 PASSWORD - CATENA - [Setup] Password Setup ${CATENA_PASSWORD} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P nq1 stat + [Setup] Password Setup ${RSPAMD_CATENA_PASSWORD} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -P nq1 stat Check Rspamc ${result} Messages scanned: PASSWORD - CATENA WRONG - [Setup] Password Setup ${CATENA_PASSWORD} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q stat + [Setup] Password Setup ${RSPAMD_CATENA_PASSWORD} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -P q stat Should Be Equal As Integers ${result.rc} 1 PASSWORD - ENABLE - [Setup] Password Setup ${CATENA_PASSWORD} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P nq2 stat_reset + [Setup] Password Setup ${RSPAMD_CATENA_PASSWORD} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -P nq2 stat_reset Check Rspamc ${result} Messages scanned: PASSWORD - ENABLE WITH NORMAL - [Setup] Password Setup ${CATENA_PASSWORD} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P nq1 stat_reset + [Setup] Password Setup ${RSPAMD_CATENA_PASSWORD} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -P nq1 stat_reset Should Be Equal As Integers ${result.rc} 1 PASSWORD - ENABLE INCORRECT - [Setup] Password Setup ${CATENA_PASSWORD} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q2q2 stat_reset + [Setup] Password Setup ${RSPAMD_CATENA_PASSWORD} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -P q2q2 stat_reset Should Be Equal As Integers ${result.rc} 1 *** Keywords *** Password Setup - [Arguments] ${PASSWORD} ${ENABLE_PASSWORD}=nq2 - Set Test Variable ${PASSWORD} - Set Test Variable ${ENABLE_PASSWORD} - Generic Setup + [Arguments] ${RSPAMD_PASSWORD} ${RSPAMD_ENABLE_PASSWORD}=nq2 + Set Test Variable ${RSPAMD_PASSWORD} + Set Test Variable ${RSPAMD_ENABLE_PASSWORD} + Rspamd Setup diff --git a/test/functional/cases/104_get_from.robot b/test/functional/cases/104_get_from.robot index c15e0cdba..84b754f37 100644 --- a/test/functional/cases/104_get_from.robot +++ b/test/functional/cases/104_get_from.robot @@ -1,53 +1,52 @@ *** Settings *** -Suite Setup Generic Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/lua_script.conf -${LUA_SCRIPT} ${TESTDIR}/lua/get_from.lua -${RSPAMD_SCOPE} Suite - -${SYMBOL} GET_FROM -${OPTIONS1} ,user@example.org,user,example.org -${OPTIONS2} First Last,user@example.org,user,example.org -${OPTIONS3} First M. Last,user@example.org,user,example.org +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_script.conf +${OPTIONS1} ,user@example.org,user,example.org +${OPTIONS2} First Last,user@example.org,user,example.org +${OPTIONS3} First M. Last,user@example.org,user,example.org +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/get_from.lua +${RSPAMD_SCOPE} Suite +${SYMBOL} GET_FROM *** Test Cases *** task:get_from('mime') - address only - Scan File ${TESTDIR}/messages/from/from.eml + Scan File ${RSPAMD_TESTDIR}/messages/from/from.eml Expect Symbol ${SYMBOL} task:get_from('mime') - comment - Scan File ${TESTDIR}/messages/from/from_comment.eml + Scan File ${RSPAMD_TESTDIR}/messages/from/from_comment.eml Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS1} task:get_from('mime') - display name - Scan File ${TESTDIR}/messages/from/from_dn.eml + Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn.eml Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2} task:get_from('mime') - display name Base64 - Scan File ${TESTDIR}/messages/from/from_dn_base64.eml + Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn_base64.eml Expect Symbol With Exact Options ${SYMBOL} Кириллица,user@example.org,user,example.org task:get_from('mime') - display name and comment - Scan File ${TESTDIR}/messages/from/from_dn_comment.eml + Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn_comment.eml Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2} task:get_from('mime') - quoted display name - Scan File ${TESTDIR}/messages/from/from_quoted_dn.eml + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn.eml Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} task:get_from('mime') - quoted display name and comment - Scan File ${TESTDIR}/messages/from/from_quoted_dn_comment.eml + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_comment.eml Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} task:get_from('mime') - quoted in the middle of DN (outer spaces) - Scan File ${TESTDIR}/messages/from/from_quoted_dn_middle.eml + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_middle.eml Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} task:get_from('mime') - quoted in the middle of DN (inner spaces) - Scan File ${TESTDIR}/messages/from/from_quoted_dn_middle_inner.eml + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_middle_inner.eml Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} diff --git a/test/functional/cases/105_mimetypes.robot b/test/functional/cases/105_mimetypes.robot index a29ffcb6d..aa344aebd 100644 --- a/test/functional/cases/105_mimetypes.robot +++ b/test/functional/cases/105_mimetypes.robot @@ -1,72 +1,66 @@ *** Settings *** -Suite Setup MIMETypes Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/mime_types.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Zip - Scan File ${TESTDIR}/messages/zip.eml + Scan File ${RSPAMD_TESTDIR}/messages/zip.eml Expect Symbol With Exact Options MIME_BAD_EXTENSION exe Zip Double Bad Extension - Scan File ${TESTDIR}/messages/zip-doublebad.eml + Scan File ${RSPAMD_TESTDIR}/messages/zip-doublebad.eml Expect Symbol With Exact Options MIME_DOUBLE_BAD_EXTENSION .pdf.exe Next-to-last Double Bad Extension - Scan File ${TESTDIR}/messages/next2last-doublebad.eml + Scan File ${RSPAMD_TESTDIR}/messages/next2last-doublebad.eml Expect Symbol With Exact Options MIME_DOUBLE_BAD_EXTENSION .scr.xz Date is followed by Bad Extension - Scan File ${TESTDIR}/messages/rar-date-bad-ext.eml + Scan File ${RSPAMD_TESTDIR}/messages/rar-date-bad-ext.eml Expect Symbol With Exact Options MIME_BAD_EXTENSION scr Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION Dotted file name is followed by Bad Extension - Scan File ${TESTDIR}/messages/bad_ext.dotted_file_name.eml + Scan File ${RSPAMD_TESTDIR}/messages/bad_ext.dotted_file_name.eml Expect Symbol With Exact Options MIME_BAD_EXTENSION exe Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION Dotted numbers in parentheses is followed by Bad Extension - Scan File ${TESTDIR}/messages/next2last-digits_in_parens.eml + Scan File ${RSPAMD_TESTDIR}/messages/next2last-digits_in_parens.eml Expect Symbol With Exact Options MIME_BAD_EXTENSION msi Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION Dotted numbers in square brackets is followed by Bad Extension - Scan File ${TESTDIR}/messages/next2last-digits_in_brackets.eml + Scan File ${RSPAMD_TESTDIR}/messages/next2last-digits_in_brackets.eml Expect Symbol With Exact Options MIME_BAD_EXTENSION msi Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION Rar4 - Scan File ${TESTDIR}/messages/rar4.eml + Scan File ${RSPAMD_TESTDIR}/messages/rar4.eml Expect Symbol With Exact Options MIME_BAD_EXTENSION exe Cloaked Archive Extension - Scan File ${TESTDIR}/messages/f.zip.gz.eml + Scan File ${RSPAMD_TESTDIR}/messages/f.zip.gz.eml Expect Symbol With Exact Options MIME_ARCHIVE_IN_ARCHIVE .zip.gz zip Multipart Archive Extension - Scan File ${TESTDIR}/messages/f.zip.001.eml + Scan File ${RSPAMD_TESTDIR}/messages/f.zip.001.eml Do Not Expect Symbol MIME_ARCHIVE_IN_ARCHIVE Exe file, but name in filename_whitelist - Scan File ${TESTDIR}/messages/exe_attm.eml + Scan File ${RSPAMD_TESTDIR}/messages/exe_attm.eml Do Not Expect Symbol MIME_BAD_EXTENSION Do Not Expect Symbol MIME_BAD_ATTACHMENT Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION Empty text part should not be treat as html - Scan File ${TESTDIR}/messages/empty-plain-text.eml + Scan File ${RSPAMD_TESTDIR}/messages/empty-plain-text.eml Do Not Expect Symbol FORGED_OUTLOOK_HTML - -*** Keywords *** -MIMETypes Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/mime_types.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/106_mid.robot b/test/functional/cases/106_mid.robot index d220abc22..a42b098aa 100644 --- a/test/functional/cases/106_mid.robot +++ b/test/functional/cases/106_mid.robot @@ -1,42 +1,36 @@ *** Settings *** -Suite Setup MID Setup -Suite Teardown Normal Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/mid.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** MID - invalid Message-ID - Scan File ${TESTDIR}/messages/fws_fp.eml + Scan File ${RSPAMD_TESTDIR}/messages/fws_fp.eml Expect Symbol With Score INVALID_MSGID 1.70 Do Not Expect Symbol MISSING_MID Do Not Expect Symbol INVALID_MSGID_ALLOWED MID - invalid Message-ID allowed - Scan File ${TESTDIR}/messages/invalid_mid_allowed.eml + Scan File ${RSPAMD_TESTDIR}/messages/invalid_mid_allowed.eml Expect Symbol With Score INVALID_MSGID_ALLOWED 1.00 Do Not Expect Symbol MISSING_MID Do Not Expect Symbol INVALID_MSGID MID - missing Message-ID - Scan File ${TESTDIR}/messages/freemail.eml + Scan File ${RSPAMD_TESTDIR}/messages/freemail.eml Expect Symbol With Score MISSING_MID 2.50 Do Not Expect Symbol MISSING_MID_ALLOWED Do Not Expect Symbol INVALID_MSGID MID - missing Message-ID allowed - Scan File ${TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml Expect Symbol With Score MISSING_MID_ALLOWED 1.00 Do Not Expect Symbol MISSING_MID Do Not Expect Symbol INVALID_MSGID - -*** Keywords *** -MID Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/mid.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/108_settings.robot b/test/functional/cases/108_settings.robot index 6e02e57a3..e7f4213a5 100644 --- a/test/functional/cases/108_settings.robot +++ b/test/functional/cases/108_settings.robot @@ -1,22 +1,22 @@ *** Settings *** Suite Setup Settings Setup Suite Teardown Settings Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${LUA_SCRIPT} ${TESTDIR}/lua/settings.lua -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${MESSAGE_PRIORITY} ${TESTDIR}/messages/priority.eml -${MESSAGE_7BIT} ${TESTDIR}/messages/utf.eml -${MESSAGE_CUSTOM_HDR} ${TESTDIR}/messages/empty-plain-text.eml -${MESSAGE_ABSENT_MIME} ${TESTDIR}/messages/ed25519.eml -${SPAM_MESSAGE} ${TESTDIR}/messages/spam.eml -${HAM_MESSAGE} ${TESTDIR}/messages/ham.eml -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/settings.conf +${HAM_MESSAGE} ${RSPAMD_TESTDIR}/messages/ham.eml +${MESSAGE_7BIT} ${RSPAMD_TESTDIR}/messages/utf.eml +${MESSAGE_ABSENT_MIME} ${RSPAMD_TESTDIR}/messages/ed25519.eml +${MESSAGE_CUSTOM_HDR} ${RSPAMD_TESTDIR}/messages/empty-plain-text.eml +${MESSAGE_PRIORITY} ${RSPAMD_TESTDIR}/messages/priority.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/settings.lua +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat +${SPAM_MESSAGE} ${RSPAMD_TESTDIR}/messages/spam.eml *** Keywords *** Check Everything Disabled @@ -253,11 +253,10 @@ PRIORITY *** Keywords *** Settings Setup - Copy File ${TESTDIR}/data/bayes.spam.sqlite3 /tmp/bayes.spam.sqlite3 - Copy File ${TESTDIR}/data/bayes.ham.sqlite3 /tmp/bayes.ham.sqlite3 - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/settings.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG + Copy File ${RSPAMD_TESTDIR}/data/bayes.spam.sqlite3 /tmp/bayes.spam.sqlite3 + Copy File ${RSPAMD_TESTDIR}/data/bayes.ham.sqlite3 /tmp/bayes.ham.sqlite3 + Rspamd Setup Settings Teardown - Normal Teardown + Rspamd Teardown + Remove Files /tmp/bayes.spam.sqlite3 /tmp/bayes.ham.sqlite3 diff --git a/test/functional/cases/109_composites.robot b/test/functional/cases/109_composites.robot index 3aeb009ed..4d73cf4e8 100644 --- a/test/functional/cases/109_composites.robot +++ b/test/functional/cases/109_composites.robot @@ -1,15 +1,15 @@ *** Settings *** -Suite Setup Generic Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/composites.conf -${LUA_SCRIPT} ${TESTDIR}/lua/composites.lua -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Suite +${CONFIG} ${RSPAMD_TESTDIR}/configs/composites.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/composites.lua +${RSPAMD_SCOPE} Suite *** Test Cases *** Composites - All in One @@ -66,7 +66,7 @@ Composites - Opts RE Hit Do Not Expect Symbol SYMOPTS3 Composites - Opts RE Hit 2 - Scan File ${MESSAGE} opts=foo/,sym2 + Scan File ${MESSAGE} opts=sym2,foo/ Expect Symbol With Score SYMOPTS3 6.00 Do Not Expect Symbol SYMOPTS2 Do Not Expect Symbol SYMOPTS1 @@ -75,4 +75,4 @@ Composites - Opts RE Hit 3 Scan File ${MESSAGE} opts=example.com->app.link Expect Symbol With Score SYMOPTS4 6.00 Do Not Expect Symbol SYMOPTS2 - Do Not Expect Symbol SYMOPTS1
\ No newline at end of file + Do Not Expect Symbol SYMOPTS1 diff --git a/test/functional/cases/110_statistics/lib.robot b/test/functional/cases/110_statistics/lib.robot index 9dd313cd3..794a05952 100644 --- a/test/functional/cases/110_statistics/lib.robot +++ b/test/functional/cases/110_statistics/lib.robot @@ -1,34 +1,35 @@ *** Settings *** -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/stats.conf -${MESSAGE_SPAM} ${TESTDIR}/messages/spam_message.eml -${MESSAGE_HAM} ${TESTDIR}/messages/ham.eml -${REDIS_SCOPE} Suite -${REDIS_SERVER} ${EMPTY} -${RSPAMD_SCOPE} Suite -${STATS_HASH} ${EMPTY} -${STATS_KEY} ${EMPTY} +${CONFIG} ${RSPAMD_TESTDIR}/configs/stats.conf +${MESSAGE_HAM} ${RSPAMD_TESTDIR}/messages/ham.eml +${MESSAGE_SPAM} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${REDIS_SCOPE} Suite +${RSPAMD_REDIS_SERVER} null +${RSPAMD_SCOPE} Suite +${RSPAMD_STATS_BACKEND} redis +${RSPAMD_STATS_HASH} null +${RSPAMD_STATS_KEY} null *** Keywords *** Broken Learn Test - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE_SPAM} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} learn_spam ${MESSAGE_SPAM} Check Rspamc ${result} Unknown statistics error Empty Part Test - Set Test Variable ${MESSAGE} ${TESTDIR}/messages/empty_part.eml - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE} + Set Test Variable ${MESSAGE} ${RSPAMD_TESTDIR}/messages/empty_part.eml + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} learn_spam ${MESSAGE} Check Rspamc ${result} Scan File ${MESSAGE} Expect Symbol BAYES_SPAM Learn Test Set Suite Variable ${RSPAMD_STATS_LEARNTEST} 0 - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE_SPAM} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_ham ${MESSAGE_HAM} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} learn_spam ${MESSAGE_SPAM} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} learn_ham ${MESSAGE_HAM} Check Rspamc ${result} Scan File ${MESSAGE_SPAM} Expect Symbol BAYES_SPAM @@ -38,19 +39,9 @@ Learn Test Relearn Test Run Keyword If ${RSPAMD_STATS_LEARNTEST} == 0 Fail "Learn test was not run" - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_ham ${MESSAGE_SPAM} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} learn_ham ${MESSAGE_SPAM} Check Rspamc ${result} Scan File ${MESSAGE_SPAM} ${pass} = Run Keyword And Return Status Expect Symbol BAYES_HAM Run Keyword If ${pass} Pass Execution What Me Worry Do Not Expect Symbol BAYES_SPAM - -Redis Statistics Setup - ${tmpdir} = Make Temporary Directory - Set Suite Variable ${TMPDIR} ${tmpdir} - Run Redis - Generic Setup TMPDIR=${tmpdir} - -Redis Statistics Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} diff --git a/test/functional/cases/110_statistics/redis-keyed-siphash.robot b/test/functional/cases/110_statistics/redis-keyed-siphash.robot index 09d369d54..d889502ef 100644 --- a/test/functional/cases/110_statistics/redis-keyed-siphash.robot +++ b/test/functional/cases/110_statistics/redis-keyed-siphash.robot @@ -1,13 +1,12 @@ *** Settings *** -Suite Setup Redis Statistics Setup -Suite Teardown Redis Statistics Teardown +Suite Setup Rspamd Redis Setup +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Variables *** -${REDIS_SERVER} servers = "${REDIS_ADDR}:${REDIS_PORT}" -${STATS_BACKEND} redis -${STATS_HASH} hash = "siphash"; -${STATS_KEY} key = "${KEY_PVT1}"; +${RSPAMD_REDIS_SERVER} ${RSPAMD_REDIS_ADDR}:${RSPAMD_REDIS_PORT} +${RSPAMD_STATS_HASH} siphash +${RSPAMD_STATS_KEY} ${RSPAMD_KEY_PVT1} *** Test Cases *** Learn diff --git a/test/functional/cases/110_statistics/redis-keyed-xxhash.robot b/test/functional/cases/110_statistics/redis-keyed-xxhash.robot index e95b4cebc..928a9ea14 100644 --- a/test/functional/cases/110_statistics/redis-keyed-xxhash.robot +++ b/test/functional/cases/110_statistics/redis-keyed-xxhash.robot @@ -1,13 +1,12 @@ *** Settings *** -Suite Setup Redis Statistics Setup -Suite Teardown Redis Statistics Teardown +Suite Setup Rspamd Redis Setup +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Variables *** -${REDIS_SERVER} servers = "${REDIS_ADDR}:${REDIS_PORT}" -${STATS_BACKEND} redis -${STATS_HASH} hash = "xxhash"; -${STATS_KEY} key = "${KEY_PVT1}"; +${RSPAMD_REDIS_SERVER} ${RSPAMD_REDIS_ADDR}:${RSPAMD_REDIS_PORT} +${RSPAMD_STATS_HASH} xxhash +${RSPAMD_STATS_KEY} ${RSPAMD_KEY_PVT1} *** Test Cases *** Learn diff --git a/test/functional/cases/110_statistics/redis-plain-siphash.robot b/test/functional/cases/110_statistics/redis-plain-siphash.robot index deb0c9559..790a63eab 100644 --- a/test/functional/cases/110_statistics/redis-plain-siphash.robot +++ b/test/functional/cases/110_statistics/redis-plain-siphash.robot @@ -1,12 +1,11 @@ *** Settings *** -Suite Setup Redis Statistics Setup -Suite Teardown Redis Statistics Teardown +Suite Setup Rspamd Redis Setup +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Variables *** -${REDIS_SERVER} servers = "${REDIS_ADDR}:${REDIS_PORT}" -${STATS_BACKEND} redis -${STATS_HASH} hash = "siphash"; +${RSPAMD_REDIS_SERVER} ${RSPAMD_REDIS_ADDR}:${RSPAMD_REDIS_PORT} +${RSPAMD_STATS_HASH} siphash *** Test Cases *** Learn diff --git a/test/functional/cases/110_statistics/redis-plain-xxhash.robot b/test/functional/cases/110_statistics/redis-plain-xxhash.robot index 379f39767..55e7524a3 100644 --- a/test/functional/cases/110_statistics/redis-plain-xxhash.robot +++ b/test/functional/cases/110_statistics/redis-plain-xxhash.robot @@ -1,12 +1,11 @@ *** Settings *** -Suite Setup Redis Statistics Setup -Suite Teardown Redis Statistics Teardown +Suite Setup Rspamd Redis Setup +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Variables *** -${REDIS_SERVER} servers = "${REDIS_ADDR}:${REDIS_PORT}" -${STATS_BACKEND} redis -${STATS_HASH} hash = "xxhash"; +${RSPAMD_REDIS_SERVER} ${RSPAMD_REDIS_ADDR}:${RSPAMD_REDIS_PORT} +${RSPAMD_STATS_HASH} xxhash *** Test Cases *** Learn diff --git a/test/functional/cases/114_phishing.robot b/test/functional/cases/114_phishing.robot index 67e6f9aca..4bb54895b 100644 --- a/test/functional/cases/114_phishing.robot +++ b/test/functional/cases/114_phishing.robot @@ -1,17 +1,17 @@ *** Settings *** -Suite Setup Phishing Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE1} ${TESTDIR}/messages/phishing1.eml -${MESSAGE2} ${TESTDIR}/messages/phishing2.eml -${MESSAGE3} ${TESTDIR}/messages/phishing3.eml -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/phishing.conf +${MESSAGE1} ${RSPAMD_TESTDIR}/messages/phishing1.eml +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/phishing2.eml +${MESSAGE3} ${RSPAMD_TESTDIR}/messages/phishing3.eml +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat *** Test Cases *** TEST PHISHING @@ -25,9 +25,3 @@ TEST PHISHING STRICT ONE TEST PHISHING STRICT TWO Scan File ${MESSAGE3} Expect Symbol STRICTER_PHISHING - -*** Keywords *** -Phishing Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/phishing.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/115_dmarc.robot b/test/functional/cases/115_dmarc.robot index 120e4461c..d0ba8c72d 100644 --- a/test/functional/cases/115_dmarc.robot +++ b/test/functional/cases/115_dmarc.robot @@ -1,94 +1,88 @@ *** Settings *** -Suite Setup DMARC Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dmarc.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat *** Test Cases *** DMARC NONE PASS DKIM - Scan File ${TESTDIR}/messages/dmarc/pass_none.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pass_none.eml Expect Symbol DMARC_POLICY_ALLOW DMARC NONE PASS SPF - Scan File ${TESTDIR}/messages/dmarc/fail_none.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml ... IP=8.8.4.4 From=foo@spf.cacophony.za.org Expect Symbol DMARC_POLICY_ALLOW DMARC NONE FAIL - Scan File ${TESTDIR}/messages/dmarc/fail_none.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml Expect Symbol DMARC_POLICY_SOFTFAIL DMARC REJECT FAIL - Scan File ${TESTDIR}/messages/dmarc/fail_reject.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_reject.eml Expect Symbol DMARC_POLICY_REJECT DMARC QUARANTINE FAIL - Scan File ${TESTDIR}/messages/dmarc/fail_quarantine.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_quarantine.eml Expect Symbol DMARC_POLICY_QUARANTINE DMARC SP NONE FAIL - Scan File ${TESTDIR}/messages/dmarc/subdomain_fail_none.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_none.eml Expect Symbol DMARC_POLICY_SOFTFAIL DMARC SP REJECT FAIL - Scan File ${TESTDIR}/messages/dmarc/subdomain_fail_reject.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_reject.eml Expect Symbol DMARC_POLICY_REJECT DMARC SP QUARANTINE FAIL - Scan File ${TESTDIR}/messages/dmarc/subdomain_fail_quarantine.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_quarantine.eml Expect Symbol DMARC_POLICY_QUARANTINE DMARC SUBDOMAIN FAIL DKIM STRICT ALIGNMENT - Scan File ${TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml Expect Symbol DMARC_POLICY_REJECT DMARC SUBDOMAIN PASS DKIM RELAXED ALIGNMENT - Scan File ${TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml Expect Symbol DMARC_POLICY_ALLOW DMARC SUBDOMAIN PASS SPF STRICT ALIGNMENT - Scan File ${TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml ... IP=37.48.67.26 From=foo@yo.mom.za.org Expect Symbol DMARC_POLICY_ALLOW DMARC SUBDOMAIN FAIL SPF STRICT ALIGNMENT - Scan File ${TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml ... IP=37.48.67.26 From=foo@mom.za.org Expect Symbol DMARC_POLICY_REJECT DMARC SUBDOMAIN PASS SPF RELAXED ALIGNMENT - Scan File ${TESTDIR}/messages/dmarc/onsubdomain_fail.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail.eml ... IP=37.48.67.26 From=foo@mom.za.org Expect Symbol DMARC_POLICY_ALLOW DMARC DNSFAIL - Scan File ${TESTDIR}/messages/dmarc/dmarc_tmpfail.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/dmarc_tmpfail.eml ... IP=37.48.67.26 From=foo@mom.za.org Expect Symbol DMARC_DNSFAIL DMARC NA NXDOMAIN - Scan File ${TESTDIR}/messages/utf.eml + Scan File ${RSPAMD_TESTDIR}/messages/utf.eml ... IP=37.48.67.26 From=foo@mom.za.org Expect Symbol DMARC_NA DMARC PCT ZERO REJECT - Scan File ${TESTDIR}/messages/dmarc/pct_none.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pct_none.eml ... IP=37.48.67.26 From=foo@mom.za.org Expect Symbol DMARC_POLICY_QUARANTINE DMARC PCT ZERO SP QUARANTINE - Scan File ${TESTDIR}/messages/dmarc/pct_none1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pct_none1.eml ... IP=37.48.67.26 From=foo@mom.za.org Expect Symbol DMARC_POLICY_SOFTFAIL - -*** Keywords *** -DMARC Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dmarc.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/116_dkim.robot b/test/functional/cases/116_dkim.robot index 45f5ad314..782648fe8 100644 --- a/test/functional/cases/116_dkim.robot +++ b/test/functional/cases/116_dkim.robot @@ -1,41 +1,41 @@ *** Settings *** -Suite Setup DKIM Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dkim.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat *** Test Cases *** DKIM PERMFAIL NXDOMAIN - Scan File ${TESTDIR}/messages/dmarc/bad_dkim2.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim2.eml ... IP=37.48.67.26 Expect Symbol R_DKIM_PERMFAIL DKIM PERMFAIL BAD RECORD - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=37.48.67.26 Expect Symbol R_DKIM_PERMFAIL DKIM TEMPFAIL SERVFAIL UNALIGNED - Scan File ${TESTDIR}/messages/dmarc/bad_dkim3.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim3.eml ... IP=37.48.67.26 Expect Symbol R_DKIM_TEMPFAIL DKIM NA NOSIG - Scan File ${TESTDIR}/messages/utf.eml + Scan File ${RSPAMD_TESTDIR}/messages/utf.eml ... IP=37.48.67.26 Expect Symbol R_DKIM_NA DKIM Sign Set Suite Variable ${RAN_SIGNTEST} 0 - ${result} = Scan Message With Rspamc ${TESTDIR}/messages/spam_message.eml --mime --header=dodkim=1 + ${result} = Scan Message With Rspamc ${RSPAMD_TESTDIR}/messages/spam_message.eml --mime --header=dodkim=1 Check Rspamc ${result} DKIM-Signature - Set Suite Variable ${SIGNED_MESSAGE} ${TMPDIR}/dkim_sign_test.eml + Set Suite Variable ${SIGNED_MESSAGE} ${RSPAMD_TMPDIR}/dkim_sign_test.eml Create File ${SIGNED_MESSAGE} ${result.stdout} Set Suite Variable ${RAN_SIGNTEST} 1 @@ -45,15 +45,9 @@ DKIM Self Verify Expect Symbol R_DKIM_ALLOW DKIM Verify ED25519 PASS - Scan File ${TESTDIR}/messages/ed25519.eml + Scan File ${RSPAMD_TESTDIR}/messages/ed25519.eml Expect Symbol R_DKIM_ALLOW DKIM Verify ED25519 REJECT - Scan File ${TESTDIR}/messages/ed25519-broken.eml + Scan File ${RSPAMD_TESTDIR}/messages/ed25519-broken.eml Expect Symbol R_DKIM_REJECT - -*** Keywords *** -DKIM Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dkim.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/117_spf.robot b/test/functional/cases/117_spf.robot index 245c9c593..1887089ef 100644 --- a/test/functional/cases/117_spf.robot +++ b/test/functional/cases/117_spf.robot @@ -1,104 +1,104 @@ *** Settings *** -Suite Setup SPF Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dmarc.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat *** Test Cases *** SPF FAIL UNRESOLVEABLE INCLUDE - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=37.48.67.26 From=x@fail3.org.org.za Expect Symbol R_SPF_FAIL SPF DNSFAIL FAILED INCLUDE UNALIGNED - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@fail2.org.org.za Expect Symbol R_SPF_DNSFAIL Expect Symbol DMARC_POLICY_SOFTFAIL SPF ALLOW UNRESOLVEABLE INCLUDE - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@fail3.org.org.za Expect Symbol R_SPF_ALLOW SPF ALLOW FAILED INCLUDE - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.4.4 From=x@fail2.org.org.za Expect Symbol R_SPF_ALLOW SPF NA NA - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@za Expect Symbol R_SPF_NA SPF NA NOREC - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@co.za Expect Symbol R_SPF_NA SPF NA NXDOMAIN - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@zzzzaaaa Expect Symbol R_SPF_NA SPF PERMFAIL UNRESOLVEABLE REDIRECT - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@fail4.org.org.za Expect Symbol R_SPF_PERMFAIL SPF REDIRECT NO USEABLE ELEMENTS - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@fail10.org.org.za Expect Symbol R_SPF_PERMFAIL SPF DNSFAIL FAILED REDIRECT - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@fail1.org.org.za Expect Symbol R_SPF_DNSFAIL SPF PERMFAIL NO USEABLE ELEMENTS - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@fail5.org.org.za Expect Symbol R_SPF_PERMFAIL SPF FAIL - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@example.net Expect Symbol R_SPF_FAIL SPF FAIL UNRESOLVEABLE MX - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=1.2.3.4 From=x@fail6.org.org.za Expect Symbol R_SPF_FAIL SPF FAIL UNRESOLVEABLE A - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=1.2.3.4 From=x@fail7.org.org.za Expect Symbol R_SPF_FAIL SPF DNSFAIL FAILED A - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=1.2.3.4 From=x@fail8.org.org.za Expect Symbol R_SPF_DNSFAIL SPF DNSFAIL FAILED MX - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=1.2.3.4 From=x@fail9.org.org.za Expect Symbol R_SPF_DNSFAIL SPF DNSFAIL FAILED RECORD - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=1.2.3.4 From=x@www.dnssec-failed.org Expect Symbol R_SPF_DNSFAIL SPF PASS INCLUDE - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@pass1.org.org.za Expect Symbol R_SPF_ALLOW @@ -123,21 +123,15 @@ SPF PTRS #Expect Symbol R_SPF_ALLOW SPF PERMFAIL REDIRECT WITHOUT SPF - Scan File ${TESTDIR}/messages/dmarc/bad_dkim4.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim4.eml ... IP=192.0.2.1 From=a@fail1.org.org.za Expect Symbol R_SPF_DNSFAIL SPF EXTERNAL RELAY - Scan File ${TESTDIR}/messages/external_relay.eml + Scan File ${RSPAMD_TESTDIR}/messages/external_relay.eml Expect Symbol With Score And Exact Options R_SPF_ALLOW 1.0 +ip4:37.48.67.26 SPF UPPERCASE - Scan File ${TESTDIR}/messages/dmarc/bad_dkim1.eml + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml ... IP=8.8.8.8 From=x@fail11.org.org.za Expect Symbol R_SPF_ALLOW - -*** Keywords *** -SPF Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dmarc.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/120_fuzzy/encrypted.robot b/test/functional/cases/120_fuzzy/encrypted.robot index 8268b234b..548ea8cb9 100644 --- a/test/functional/cases/120_fuzzy/encrypted.robot +++ b/test/functional/cases/120_fuzzy/encrypted.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Encrypted Siphash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/120_fuzzy/fasthash-keyed.robot b/test/functional/cases/120_fuzzy/fasthash-keyed.robot index 8f949fceb..6add33d69 100644 --- a/test/functional/cases/120_fuzzy/fasthash-keyed.robot +++ b/test/functional/cases/120_fuzzy/fasthash-keyed.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Keyed Fasthash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/120_fuzzy/fasthash.robot b/test/functional/cases/120_fuzzy/fasthash.robot index cf0503622..c33ede137 100644 --- a/test/functional/cases/120_fuzzy/fasthash.robot +++ b/test/functional/cases/120_fuzzy/fasthash.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Plain Fasthash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/120_fuzzy/general.robot b/test/functional/cases/120_fuzzy/general.robot index 4b19d5d00..2978ea60b 100644 --- a/test/functional/cases/120_fuzzy/general.robot +++ b/test/functional/cases/120_fuzzy/general.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Plain Siphash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/120_fuzzy/lib.robot b/test/functional/cases/120_fuzzy/lib.robot index ca6143253..96ebc8aa5 100644 --- a/test/functional/cases/120_fuzzy/lib.robot +++ b/test/functional/cases/120_fuzzy/lib.robot @@ -1,36 +1,41 @@ *** Settings *** Library OperatingSystem -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${ALGORITHM} ${EMPTY} -${CONFIG} ${TESTDIR}/configs/fuzzy.conf -${FLAG1_NUMBER} 50 -${FLAG1_SYMBOL} R_TEST_FUZZY_DENIED -${FLAG2_NUMBER} 51 -${FLAG2_SYMBOL} R_TEST_FUZZY_WHITE -@{MESSAGES} ${TESTDIR}/messages/spam_message.eml ${TESTDIR}/messages/zip.eml -@{MESSAGES_SKIP} ${TESTDIR}/messages/priority.eml -@{RANDOM_MESSAGES} ${TESTDIR}/messages/bad_message.eml ${TESTDIR}/messages/zip-doublebad.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${SETTINGS_FUZZY_WORKER} ${EMPTY} -${SETTINGS_FUZZY_CHECK} ${EMPTY} +${CONFIG} ${RSPAMD_TESTDIR}/configs/fuzzy.conf +${FLAG1_SYMBOL} R_TEST_FUZZY_DENIED +${FLAG2_SYMBOL} R_TEST_FUZZY_WHITE +${REDIS_SCOPE} Suite +${RSPAMD_FLAG1_NUMBER} 50 +${RSPAMD_FLAG2_NUMBER} 51 +${RSPAMD_FUZZY_BACKEND} redis +${RSPAMD_FUZZY_ENCRYPTED_ONLY} false +${RSPAMD_FUZZY_ENCRYPTION_KEY} null +${RSPAMD_FUZZY_INCLUDE} ${RSPAMD_TESTDIR}/configs/empty.conf +${RSPAMD_FUZZY_KEY} null +${RSPAMD_FUZZY_SHINGLES_KEY} null +${RSPAMD_SCOPE} Suite +${SETTINGS_FUZZY_CHECK} ${EMPTY} +${SETTINGS_FUZZY_WORKER} ${EMPTY} +@{MESSAGES_SKIP} ${RSPAMD_TESTDIR}/messages/priority.eml +@{MESSAGES} ${RSPAMD_TESTDIR}/messages/spam_message.eml ${RSPAMD_TESTDIR}/messages/zip.eml +@{RANDOM_MESSAGES} ${RSPAMD_TESTDIR}/messages/bad_message.eml ${RSPAMD_TESTDIR}/messages/zip-doublebad.eml *** Keywords *** Fuzzy Skip Add Test Base [Arguments] ${message} Set Suite Variable ${RSPAMD_FUZZY_ADD_${message}} 0 - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -w 10 -f - ... ${FLAG1_NUMBER} fuzzy_add ${message} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -w 10 -f + ... ${RSPAMD_FLAG1_NUMBER} fuzzy_add ${message} Check Rspamc ${result} Sync Fuzzy Storage Scan File ${message} Expect Symbol R_TEST_FUZZY_DENIED - Create File ${TMPDIR}/skip_hash.map.tmp 2d875d4737c59c4822fd01dadeba52a329de3933f766c6f167904c6a426bbfa7ea63a66bf807b25c5ee853baee58bfb18d3b423fcd13cfa7c3d77a840039a1ea - Move File ${TMPDIR}/skip_hash.map.tmp ${TMPDIR}/skip_hash.map + Create File ${RSPAMD_TMPDIR}/skip_hash.map.tmp 2d875d4737c59c4822fd01dadeba52a329de3933f766c6f167904c6a426bbfa7ea63a66bf807b25c5ee853baee58bfb18d3b423fcd13cfa7c3d77a840039a1ea + Move File ${RSPAMD_TMPDIR}/skip_hash.map.tmp ${RSPAMD_TMPDIR}/skip_hash.map Sleep 1s Wait for reload Scan File ${message} Do Not Expect Symbol R_TEST_FUZZY_DENIED @@ -38,8 +43,8 @@ Fuzzy Skip Add Test Base Fuzzy Add Test [Arguments] ${message} Set Suite Variable ${RSPAMD_FUZZY_ADD_${message}} 0 - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -w 10 -f - ... ${FLAG1_NUMBER} fuzzy_add ${message} + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -w 10 -f + ... ${RSPAMD_FLAG1_NUMBER} fuzzy_add ${message} Check Rspamc ${result} Sync Fuzzy Storage Scan File ${message} @@ -49,7 +54,7 @@ Fuzzy Add Test Fuzzy Delete Test [Arguments] ${message} Run Keyword If ${RSPAMD_FUZZY_ADD_${message}} == 0 Fail "Fuzzy Add was not run" - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -f ${FLAG1_NUMBER} fuzzy_del + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -f ${RSPAMD_FLAG1_NUMBER} fuzzy_del ... ${message} Check Rspamc ${result} Sync Fuzzy Storage @@ -73,9 +78,9 @@ Fuzzy Miss Test Fuzzy Overwrite Test [Arguments] ${message} - ${flag_numbers} = Create List ${FLAG1_NUMBER} ${FLAG2_NUMBER} + ${flag_numbers} = Create List ${RSPAMD_FLAG1_NUMBER} ${RSPAMD_FLAG2_NUMBER} FOR ${i} IN @{flag_numbers} - ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -w 10 + ${result} = Run Rspamc -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} -w 10 ... -f ${i} fuzzy_add ${message} Check Rspamc ${result} END @@ -86,34 +91,33 @@ Fuzzy Overwrite Test Fuzzy Setup Encrypted [Arguments] ${algorithm} - ${worker_settings} = Set Variable "keypair": {"pubkey": "${KEY_PUB1}", "privkey": "${KEY_PVT1}"}; "encrypted_only": true; - ${check_settings} = Set Variable encryption_key = "${KEY_PUB1}"; - Fuzzy Setup Generic ${algorithm} ${worker_settings} ${check_settings} + Set Suite Variable ${RSPAMD_FUZZY_ALGORITHM} ${algorithm} + Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTED_ONLY} true + Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB1} + Set Suite Variable ${RSPAMD_FUZZY_INCLUDE} ${RSPAMD_TESTDIR}/configs/fuzzy-encryption-key.conf + Rspamd Redis Setup Fuzzy Setup Encrypted Keyed [Arguments] ${algorithm} - ${worker_settings} = Set Variable "keypair": {"pubkey": "${KEY_PUB1}", "privkey": "${KEY_PVT1}"}; "encrypted_only": true; - ${check_settings} = Set Variable fuzzy_key = "mYN888sydwLTfE32g2hN"; fuzzy_shingles_key = "hXUCgul9yYY3Zlk1QIT2"; encryption_key = "${KEY_PUB1}"; - Fuzzy Setup Generic ${algorithm} ${worker_settings} ${check_settings} + Set Suite Variable ${RSPAMD_FUZZY_ALGORITHM} ${algorithm} + Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTED_ONLY} true + Set Suite Variable ${RSPAMD_FUZZY_ENCRYPTION_KEY} ${RSPAMD_KEY_PUB1} + + Set Suite Variable ${RSPAMD_FUZZY_KEY} mYN888sydwLTfE32g2hN + Set Suite Variable ${RSPAMD_FUZZY_SHINGLES_KEY} hXUCgul9yYY3Zlk1QIT2 + Rspamd Redis Setup Fuzzy Setup Plain [Arguments] ${algorithm} - Fuzzy Setup Generic ${algorithm} ${EMPTY} ${EMPTY} + Set Suite Variable ${RSPAMD_FUZZY_ALGORITHM} ${algorithm} + Rspamd Redis Setup Fuzzy Setup Keyed [Arguments] ${algorithm} - ${check_settings} = Set Variable fuzzy_key = "mYN888sydwLTfE32g2hN"; fuzzy_shingles_key = "hXUCgul9yYY3Zlk1QIT2"; - Fuzzy Setup Generic ${algorithm} ${EMPTY} ${check_settings} - -Fuzzy Setup Generic - [Arguments] ${algorithm} ${worker_settings} ${check_settings} &{kwargs} - ${worker_settings} = Set Variable backend \= "redis"; ${worker_settings} - ${tmpdir} = Make Temporary Directory - Set Suite Variable ${TMPDIR} ${tmpdir} - Set Suite Variable ${SETTINGS_FUZZY_WORKER} ${worker_settings} - Set Suite Variable ${SETTINGS_FUZZY_CHECK} ${check_settings} - Run Redis - Generic Setup TMPDIR=${TMPDIR} + Set Suite Variable ${RSPAMD_FUZZY_ALGORITHM} ${algorithm} + Set Suite Variable ${RSPAMD_FUZZY_KEY} mYN888sydwLTfE32g2hN + Set Suite Variable ${RSPAMD_FUZZY_SHINGLES_KEY} hXUCgul9yYY3Zlk1QIT2 + Rspamd Redis Setup Fuzzy Setup Plain Fasthash Fuzzy Setup Plain fasthash @@ -171,7 +175,3 @@ Fuzzy Multimessage Overwrite Test FOR ${i} IN @{MESSAGES} Fuzzy Overwrite Test ${i} END - -Fuzzy Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} diff --git a/test/functional/cases/120_fuzzy/mumhash-keyed.robot b/test/functional/cases/120_fuzzy/mumhash-keyed.robot index 770da125a..934a4eebb 100644 --- a/test/functional/cases/120_fuzzy/mumhash-keyed.robot +++ b/test/functional/cases/120_fuzzy/mumhash-keyed.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Keyed Mumhash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/120_fuzzy/mumhash.robot b/test/functional/cases/120_fuzzy/mumhash.robot index 5dd47aead..78abe7fe8 100644 --- a/test/functional/cases/120_fuzzy/mumhash.robot +++ b/test/functional/cases/120_fuzzy/mumhash.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Plain Mumhash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/120_fuzzy/siphash-keyed.robot b/test/functional/cases/120_fuzzy/siphash-keyed.robot index 0acef322c..a11d55996 100644 --- a/test/functional/cases/120_fuzzy/siphash-keyed.robot +++ b/test/functional/cases/120_fuzzy/siphash-keyed.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Keyed Siphash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/120_fuzzy/siphash.robot b/test/functional/cases/120_fuzzy/siphash.robot index 66d3d01d2..b477f0c97 100644 --- a/test/functional/cases/120_fuzzy/siphash.robot +++ b/test/functional/cases/120_fuzzy/siphash.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Plain Siphash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/120_fuzzy/xxhash-keyed.robot b/test/functional/cases/120_fuzzy/xxhash-keyed.robot index ffe553ad9..84df1df24 100644 --- a/test/functional/cases/120_fuzzy/xxhash-keyed.robot +++ b/test/functional/cases/120_fuzzy/xxhash-keyed.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Keyed Xxhash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/120_fuzzy/xxhash.robot b/test/functional/cases/120_fuzzy/xxhash.robot index 966b7e224..f7b6fa266 100644 --- a/test/functional/cases/120_fuzzy/xxhash.robot +++ b/test/functional/cases/120_fuzzy/xxhash.robot @@ -1,6 +1,6 @@ *** Settings *** Suite Setup Fuzzy Setup Plain Xxhash -Suite Teardown Fuzzy Teardown +Suite Teardown Rspamd Redis Teardown Resource lib.robot *** Test Cases *** diff --git a/test/functional/cases/121_json/100_preresult.robot b/test/functional/cases/121_json/100_preresult.robot index aa25c0272..04aac069c 100644 --- a/test/functional/cases/121_json/100_preresult.robot +++ b/test/functional/cases/121_json/100_preresult.robot @@ -1,16 +1,16 @@ *** Settings *** -Suite Setup Generic Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py Resource lib.robot -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/lua_test.conf -${LUA_SCRIPT} ${TESTDIR}/lua/preresult.lua -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Suite +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/preresult.lua +${RSPAMD_SCOPE} Suite *** Test Cases *** Stat diff --git a/test/functional/cases/121_json/101_simple.robot b/test/functional/cases/121_json/101_simple.robot index da5aa0f19..98ff0ea00 100644 --- a/test/functional/cases/121_json/101_simple.robot +++ b/test/functional/cases/121_json/101_simple.robot @@ -1,16 +1,16 @@ *** Settings *** -Suite Setup Generic Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py Resource lib.robot -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/lua_test.conf -${LUA_SCRIPT} ${TESTDIR}/lua/simple.lua -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Suite +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/simple.lua +${RSPAMD_SCOPE} Suite *** Test Cases *** Stat diff --git a/test/functional/cases/121_json/lib.robot b/test/functional/cases/121_json/lib.robot index 4d87485dc..68bf56628 100644 --- a/test/functional/cases/121_json/lib.robot +++ b/test/functional/cases/121_json/lib.robot @@ -1,9 +1,9 @@ *** Variables *** -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Keywords *** Stat Test - @{result} = HTTP GET ${LOCAL_ADDR} ${PORT_CONTROLLER} /stat + @{result} = HTTP GET ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_CONTROLLER} /stat Check JSON ${result}[1] Should Be Equal As Integers ${result}[0] 200 @@ -11,12 +11,12 @@ History Test [Arguments] ${rspamc_expected_result} ${result} = Scan Message With Rspamc ${MESSAGE} Check Rspamc ${result} ${rspamc_expected_result} - @{result} = HTTP GET ${LOCAL_ADDR} ${PORT_CONTROLLER} /history + @{result} = HTTP GET ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_CONTROLLER} /history Check JSON ${result}[1] Should Be Equal As Integers ${result}[0] 200 Scan Test ${content} = Get File ${MESSAGE} - @{result} = HTTP POST ${LOCAL_ADDR} ${PORT_NORMAL} /check ${content} + @{result} = HTTP POST ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} /check ${content} Check JSON ${result}[1] Should Be Equal As Integers ${result}[0] 200 diff --git a/test/functional/cases/123_whitelist.robot b/test/functional/cases/123_whitelist.robot index 6482793a3..460fc0bd7 100644 --- a/test/functional/cases/123_whitelist.robot +++ b/test/functional/cases/123_whitelist.robot @@ -1,22 +1,20 @@ *** Settings *** -Suite Setup Whitelist Setup -Suite Teardown Normal Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${M_DMARC_OK} ${TESTDIR}/messages/dmarc/pass_none.eml -${M_DMARC_BAD} ${TESTDIR}/messages/dmarc/fail_none.eml - -${M_DKIM_RSPAMD_OK} ${TESTDIR}/messages/dmarc/good_dkim_rspamd.eml -${M_DKIM_RSPAMD_BAD} ${TESTDIR}/messages/dmarc/bad_dkim_rspamd.eml -${M_NO_DKIM_VALID_SPF} ${TESTDIR}/messages/dmarc/no_dkim_valid_spf.eml - -${UTF_MESSAGE} ${TESTDIR}/messages/utf.eml -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/whitelist.conf +${M_DKIM_RSPAMD_BAD} ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim_rspamd.eml +${M_DKIM_RSPAMD_OK} ${RSPAMD_TESTDIR}/messages/dmarc/good_dkim_rspamd.eml +${M_DMARC_BAD} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml +${M_DMARC_OK} ${RSPAMD_TESTDIR}/messages/dmarc/pass_none.eml +${M_NO_DKIM_VALID_SPF} ${RSPAMD_TESTDIR}/messages/dmarc/no_dkim_valid_spf.eml +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat +${UTF_MESSAGE} ${RSPAMD_TESTDIR}/messages/utf.eml *** Test Cases *** WHITELISTS @@ -76,9 +74,3 @@ VALID SPF and NO DKIM Do Not Expect Symbol R_DKIM_REJECT Do Not Expect Symbol WHITELIST_SPF_DKIM Do Not Expect Symbol R_DKIM_ALLOW - -*** Keywords *** -Whitelist Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/whitelist.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/125_map_reload.robot b/test/functional/cases/125_map_reload.robot index be7e0a722..4c05ef4d8 100644 --- a/test/functional/cases/125_map_reload.robot +++ b/test/functional/cases/125_map_reload.robot @@ -1,16 +1,16 @@ *** Settings *** Suite Setup Map Reload Setup Suite Teardown Map Reload Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/lua_test.conf +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf ${MAP_WATCH_INTERVAL} 0.5s -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** CHECK HIT AND MISS @@ -19,7 +19,7 @@ CHECK HIT AND MISS WRITE NEW MAP ${TMP_FILE} = Make Temporary File - Copy File ${TESTDIR}/configs/maps/domains.list.2 ${TMP_FILE} + Copy File ${RSPAMD_TESTDIR}/configs/maps/domains.list.2 ${TMP_FILE} Move File ${TMP_FILE} ${MAP_FILE} CHECK HIT AND MISS AFTER RELOAD @@ -29,19 +29,19 @@ CHECK HIT AND MISS AFTER RELOAD *** Keywords *** Map Reload Setup - ${MAP1} = Get File ${TESTDIR}/configs/maps/domains.list + ${MAP1} = Get File ${RSPAMD_TESTDIR}/configs/maps/domains.list ${MAP_FILE} = Make Temporary File - ${LUA_SCRIPT} = Make Temporary File - Set Suite Variable ${LUA_SCRIPT} + ${RSPAMD_LUA_SCRIPT} = Make Temporary File + Set Suite Variable ${RSPAMD_LUA_SCRIPT} Set Suite Variable ${MAP_FILE} Set Suite Variable ${MAP1} - ${lua} = Get File ${TESTDIR}/lua/mapreload.lua + ${lua} = Get File ${RSPAMD_TESTDIR}/lua/mapreload.lua ${lua} = Replace Variables ${lua} - Create File ${LUA_SCRIPT} ${lua} + Create File ${RSPAMD_LUA_SCRIPT} ${lua} Create File ${MAP_FILE} ${MAP1} - Generic Setup + Rspamd Setup Map Reload Teardown Remove File ${MAP_FILE} - Remove File ${LUA_SCRIPT} - Normal Teardown + Remove File ${RSPAMD_LUA_SCRIPT} + Rspamd Teardown diff --git a/test/functional/cases/131_dkim_signing/001_simple.robot b/test/functional/cases/131_dkim_signing/001_simple.robot index 2bcd53f36..3929d8731 100644 --- a/test/functional/cases/131_dkim_signing/001_simple.robot +++ b/test/functional/cases/131_dkim_signing/001_simple.robot @@ -1,17 +1,17 @@ *** Settings *** -Suite Setup DKIM Signing Setup -Suite Teardown DKIM Signing Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/dmarc/fail_none.eml -${MESSAGE_FAIL} ${TESTDIR}/messages/dmarc/fail_none1.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dkim_signing/simple.conf +${MESSAGE_FAIL} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none1.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** TEST SIGNED @@ -33,12 +33,3 @@ TEST NOT SIGNED - USERNAME WRONG PUBKEY ${result} = Scan Message With Rspamc ${MESSAGE_FAIL} -u bob@invalid.za.org Check Rspamc ${result} DKIM-Signature: inverse=1 Should Not Contain ${result.stdout} DKIM_SIGNED - -*** Keywords *** -DKIM Signing Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dkim_signing/simple.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -DKIM Signing Teardown - Normal Teardown diff --git a/test/functional/cases/131_dkim_signing/002_redis.robot b/test/functional/cases/131_dkim_signing/002_redis.robot index e87749a0a..6e8f8885f 100644 --- a/test/functional/cases/131_dkim_signing/002_redis.robot +++ b/test/functional/cases/131_dkim_signing/002_redis.robot @@ -1,16 +1,16 @@ *** Settings *** Suite Setup DKIM Signing Setup -Suite Teardown DKIM Signing Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Teardown Rspamd Redis Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/dmarc/fail_none.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dkim_signing/redis.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** TEST SIGNED @@ -25,14 +25,7 @@ TEST NOT SIGNED - USERNAME WRONG DOMAIN *** Keywords *** DKIM Signing Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dkim_signing/redis.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - Run Redis + Rspamd Redis Setup Redis HSET TEST_DKIM_SELECTORS cacophony.za.org dkim - ${key} = Get File ${TESTDIR}/configs/dkim.key + ${key} = Get File ${RSPAMD_TESTDIR}/configs/dkim.key Redis HSET TEST_DKIM_KEYS dkim.cacophony.za.org ${key} - -DKIM Signing Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} diff --git a/test/functional/cases/131_dkim_signing/003_eddsa.robot b/test/functional/cases/131_dkim_signing/003_eddsa.robot index ea2fe03be..27d1c0c86 100644 --- a/test/functional/cases/131_dkim_signing/003_eddsa.robot +++ b/test/functional/cases/131_dkim_signing/003_eddsa.robot @@ -1,17 +1,17 @@ *** Settings *** -Suite Setup DKIM Signing Setup -Suite Teardown DKIM Signing Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/dmarc/fail_none.eml -${MESSAGE_FAIL} ${TESTDIR}/messages/dmarc/fail_none1.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dkim_signing/eddsa.conf +${MESSAGE_FAIL} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none1.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** TEST SIGNED @@ -28,12 +28,3 @@ TEST NOT SIGNED - USERNAME WRONG PUBKEY ${result} = Scan Message With Rspamc ${MESSAGE_FAIL} -u bob@invalid.za.org Check Rspamc ${result} DKIM-Signature: inverse=1 Should Not Contain ${result.stdout} DKIM_SIGNED - -*** Keywords *** -DKIM Signing Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dkim_signing/eddsa.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -DKIM Signing Teardown - Normal Teardown diff --git a/test/functional/cases/131_dkim_signing/004_invalidate_key.robot b/test/functional/cases/131_dkim_signing/004_invalidate_key.robot index 2cf34e305..2218c3418 100644 --- a/test/functional/cases/131_dkim_signing/004_invalidate_key.robot +++ b/test/functional/cases/131_dkim_signing/004_invalidate_key.robot @@ -2,16 +2,16 @@ Force Tags isbroken Suite Setup Key Invalidation Setup Suite Teardown Key Invalidation Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/dmarc/fail_none.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dkim_signing/invalidate.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** TEST SIGNED @@ -34,19 +34,17 @@ TEST NOT SIGNED - KEY NO LONGER MATCHES *** Keywords *** Key Invalidation Setup ${key_dir} Make Temporary Directory - Set Suite Variable ${KEY_DIR} ${key_dir} - Copy File ${TESTDIR}/configs/dkim-eddsa.key ${KEY_DIR}/dkim-eddsa.key - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dkim_signing/invalidate.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG + Set Suite Variable ${RSPAMD_KEY_DIR} ${key_dir} + Copy File ${RSPAMD_TESTDIR}/configs/dkim-eddsa.key ${RSPAMD_KEY_DIR}/dkim-eddsa.key + Rspamd Setup Delete Key - Remove File ${KEY_DIR}/dkim-eddsa.key + Remove File ${RSPAMD_KEY_DIR}/dkim-eddsa.key Move Key - Copy File ${TESTDIR}/configs/dkim.key ${KEY_DIR}/dkim-eddsa.key - Set Modified Time ${KEY_DIR}/dkim-eddsa.key NOW + 3s + Copy File ${RSPAMD_TESTDIR}/configs/dkim.key ${RSPAMD_KEY_DIR}/dkim-eddsa.key + Set Modified Time ${RSPAMD_KEY_DIR}/dkim-eddsa.key NOW + 3s Key Invalidation Teardown - Cleanup Temporary Directory ${KEY_DIR} - Normal Teardown + Cleanup Temporary Directory ${RSPAMD_KEY_DIR} + Rspamd Teardown diff --git a/test/functional/cases/131_dkim_signing/005_multiple.robot b/test/functional/cases/131_dkim_signing/005_multiple.robot index 72222f460..067220dff 100644 --- a/test/functional/cases/131_dkim_signing/005_multiple.robot +++ b/test/functional/cases/131_dkim_signing/005_multiple.robot @@ -1,29 +1,20 @@ *** Settings *** -Suite Setup DKIM Signing Setup -Suite Teardown DKIM Signing Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/dmarc/fail_none.eml -${MESSAGE_FAIL} ${TESTDIR}/messages/dmarc/fail_none1.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dkim_signing/multiple.conf +${MESSAGE_FAIL} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none1.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** TEST DOUBLE SIGNED ${result} = Scan Message With Rspamc ${MESSAGE} -u bob@cacophony.za.org Check Rspamc ${result} (?s)DKIM-Signature.+DKIM-Signature re=1 Should Contain ${result.stdout} DKIM_SIGNED - -*** Keywords *** -DKIM Signing Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dkim_signing/multiple.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -DKIM Signing Teardown - Normal Teardown diff --git a/test/functional/cases/131_dkim_signing/006_milter.robot b/test/functional/cases/131_dkim_signing/006_milter.robot index cd48a62b7..cfa1bafce 100644 --- a/test/functional/cases/131_dkim_signing/006_milter.robot +++ b/test/functional/cases/131_dkim_signing/006_milter.robot @@ -1,14 +1,15 @@ *** Settings *** -Suite Setup DKIM Milter Setup -Suite Teardown Generic Teardown +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dkim_signing/milter.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** SINGLE SIGNATURE @@ -18,13 +19,10 @@ MULTIPLE SIGNATURES Milter Test dkim_many.lua *** Keywords *** -DKIM Milter Setup - Generic Setup CONFIG=${TESTDIR}/configs/dkim_signing/milter.conf - Milter Test [Arguments] ${mtlua} - ${result} = Run Process miltertest -Dport\=${PORT_PROXY} -Dhost\=${LOCAL_ADDR} -s ${TESTDIR}/lua/miltertest/${mtlua} - ... cwd=${TESTDIR}/lua/miltertest + ${result} = Run Process miltertest -Dport\=${RSPAMD_PORT_PROXY} -Dhost\=${RSPAMD_LOCAL_ADDR} -s ${RSPAMD_TESTDIR}/lua/miltertest/${mtlua} + ... cwd=${RSPAMD_TESTDIR}/lua/miltertest Should Match Regexp ${result.stderr} ^$ Log ${result.rc} Log ${result.stdout} diff --git a/test/functional/cases/131_dkim_signing/007_sign_maps.robot b/test/functional/cases/131_dkim_signing/007_sign_maps.robot index 69d4c9a92..f0523cdf8 100644 --- a/test/functional/cases/131_dkim_signing/007_sign_maps.robot +++ b/test/functional/cases/131_dkim_signing/007_sign_maps.robot @@ -1,17 +1,17 @@ *** Settings *** -Suite Setup DKIM Signing Setup -Suite Teardown DKIM Signing Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/dmarc/fail_none.eml -${MESSAGE_FAIL} ${TESTDIR}/messages/dmarc/fail_none1.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/dkim_signing/sign_maps.conf +${MESSAGE_FAIL} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none1.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** TEST SIGNED @@ -23,12 +23,3 @@ TEST NOT SIGNED - FROM WRONG DOMAIN ${result} = Scan Message With Rspamc ${MESSAGE_FAIL} -u bob@cacophony.za.org Check Rspamc ${result} DKIM-Signature: inverse=1 Should Not Contain ${result.stdout} DKIM_SIGNED - -*** Keywords *** -DKIM Signing Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/dkim_signing/sign_maps.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -DKIM Signing Teardown - Normal Teardown diff --git a/test/functional/cases/135_spamassassin.robot b/test/functional/cases/135_spamassassin.robot index d8d075b00..f9691fddd 100644 --- a/test/functional/cases/135_spamassassin.robot +++ b/test/functional/cases/135_spamassassin.robot @@ -1,18 +1,18 @@ *** Settings *** -Suite Setup SpamAssassin Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/spamassassin.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** FREEMAIL - Scan File ${TESTDIR}/messages/freemail.eml + Scan File ${RSPAMD_TESTDIR}/messages/freemail.eml ... From=faked.asdfjisiwosp372@outlook.com Expect Symbol FREEMAIL_FROM Expect Symbol FREEMAIL_ENVFROM_END_DIGIT @@ -20,21 +20,15 @@ FREEMAIL Expect Symbol TEST_META4 WLBL WHITELIST - Scan File ${TESTDIR}/messages/bad_message.eml + Scan File ${RSPAMD_TESTDIR}/messages/bad_message.eml Expect Symbol USER_IN_WHITELIST Expect Symbol USER_IN_WHITELIST_TO Do Not Expect Symbol USER_IN_BLACKLIST_TO Do Not Expect Symbol USER_IN_BLACKLIST WLBL BLACKLIST - Scan File ${TESTDIR}/messages/utf.eml + Scan File ${RSPAMD_TESTDIR}/messages/utf.eml Expect Symbol USER_IN_BLACKLIST Expect Symbol USER_IN_BLACKLIST_TO Do Not Expect Symbol USER_IN_WHITELIST_TO Do Not Expect Symbol USER_IN_WHITELIST - -*** Keywords *** -SpamAssassin Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/spamassassin.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/140_proxy.robot b/test/functional/cases/140_proxy.robot index 39b3faf87..d43cfa43c 100644 --- a/test/functional/cases/140_proxy.robot +++ b/test/functional/cases/140_proxy.robot @@ -1,40 +1,50 @@ *** Settings *** Suite Setup Proxy Setup Suite Teardown Proxy Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${LUA_SCRIPT} ${TESTDIR}/lua/simple.lua -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/simple.lua +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** HTTP PROTOCOL - Set Test Variable ${PORT_NORMAL} ${PORT_PROXY} + Set Test Variable ${RSPAMD_PORT_NORMAL} ${RSPAMD_PORT_PROXY} Scan File ${MESSAGE} Expect Symbol SIMPLE_TEST SPAMC - ${result} = Spamc ${LOCAL_ADDR} ${PORT_PROXY} ${MESSAGE} + ${result} = Spamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_PROXY} ${MESSAGE} Should Contain ${result} SPAMD/1.1 0 EX_OK RSPAMC Legacy Protocol - ${result} = Rspamc ${LOCAL_ADDR} ${PORT_PROXY} ${MESSAGE} + ${result} = Rspamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_PROXY} ${MESSAGE} Should Contain ${result} RSPAMD/1.3 0 EX_OK *** Keywords *** Proxy Setup - &{d} = Run Rspamd CONFIG=${TESTDIR}/configs/lua_test.conf - Set Suite Variable ${SLAVE_PID} ${d}[RSPAMD_PID] - Set Suite Variable ${SLAVE_TMPDIR} ${d}[TMPDIR] - &{d} = Run Rspamd CONFIG=${TESTDIR}/configs/proxy.conf - Set Suite Variable ${PROXY_PID} ${d}[RSPAMD_PID] - Set Suite Variable ${PROXY_TMPDIR} ${d}[TMPDIR] + # Run slave & copy variables + Set Suite Variable ${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf + Rspamd Setup + Set Suite Variable ${SLAVE_PID} ${RSPAMD_PID} + Set Suite Variable ${SLAVE_TMPDIR} ${RSPAMD_TMPDIR} + + # Run proxy & copy variables + Set Suite Variable ${CONFIG} ${RSPAMD_TESTDIR}/configs/proxy.conf + Rspamd Setup + Set Suite Variable ${PROXY_PID} ${RSPAMD_PID} + Set Suite Variable ${PROXY_TMPDIR} ${RSPAMD_TMPDIR} Proxy Teardown - Shutdown Process With Children ${PROXY_PID} - Shutdown Process With Children ${SLAVE_PID} - Cleanup Temporary Directory ${PROXY_TMPDIR} - Cleanup Temporary Directory ${SLAVE_TMPDIR} + # Restore variables & run normal teardown + Set Suite Variable ${RSPAMD_PID} ${PROXY_PID} + Set Suite Variable ${RSPAMD_TMPDIR} ${PROXY_TMPDIR} + Rspamd Teardown + # Do it again for slave + Set Suite Variable ${RSPAMD_PID} ${SLAVE_PID} + Set Suite Variable ${RSPAMD_TMPDIR} ${SLAVE_TMPDIR} + Rspamd Teardown diff --git a/test/functional/cases/150_rspamadm.robot b/test/functional/cases/150_rspamadm.robot index 82532ddab..879d4d7e8 100644 --- a/test/functional/cases/150_rspamadm.robot +++ b/test/functional/cases/150_rspamadm.robot @@ -28,12 +28,12 @@ Simple interpreter, two results Process message callback ${handle} = Start Process ${RSPAMADM} lua - ${result} = Write to stdin ${handle} .load ${TESTDIR}/lua/rspamadm/test_message_callback.lua\n.message message_callback ${TESTDIR}/messages/empty_part.eml + ${result} = Write to stdin ${handle} .load ${RSPAMD_TESTDIR}/lua/rspamadm/test_message_callback.lua\n.message message_callback ${RSPAMD_TESTDIR}/messages/empty_part.eml Should Contain ${result} n parts = 2 Should Contain ${result} 1\n2\n4\n6 Lua batch mode - ${result} = Run Process ${RSPAMADM} lua -b ${TESTDIR}/lua/rspamadm/test_batch.lua + ${result} = Run Process ${RSPAMADM} lua -b ${RSPAMD_TESTDIR}/lua/rspamadm/test_batch.lua Should Match Regexp ${result.stderr} ^$ Should Be Equal As Integers ${result.rc} 0 Should Be Equal ${result.stdout} hello world diff --git a/test/functional/cases/151_rspamadm_async.robot b/test/functional/cases/151_rspamadm_async.robot index 17d5826c4..2b0d227ff 100644 --- a/test/functional/cases/151_rspamadm_async.robot +++ b/test/functional/cases/151_rspamadm_async.robot @@ -2,26 +2,25 @@ Test Setup Rspamadm test Setup Test Teardown Rspamadm test Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py Suite Teardown Terminate All Processes kill=True *** Variables *** -${REDIS_SCOPE} Test -${CONFIG} ${TESTDIR}/configs/plugins.conf -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${PLUGIN_CONFIG} +${CONFIG} ${RSPAMD_TESTDIR}/configs/plugins.conf +${REDIS_SCOPE} Test +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Tcp client - ${result} = Run Process ${RSPAMADM} lua -b ${TESTDIR}/lua/rspamadm/test_tcp_client.lua + ${result} = Run Process ${RSPAMADM} lua -b ${RSPAMD_TESTDIR}/lua/rspamadm/test_tcp_client.lua Should Match Regexp ${result.stderr} ^$ Should Be Equal As Integers ${result.rc} 0 Should Be Equal ${result.stdout} hello post Redis client - ${result} = Run Process ${RSPAMADM} lua -b ${TESTDIR}/lua/rspamadm/test_redis_client.lua + ${result} = Run Process ${RSPAMADM} lua -b ${RSPAMD_TESTDIR}/lua/rspamadm/test_redis_client.lua Should Match Regexp ${result.stderr} ^$ Should Be Equal As Integers ${result.rc} 0 Should Be Equal ${result.stdout} true\thello from lua on redis @@ -29,7 +28,7 @@ Redis client DNS client ${tmpdir} = Prepare temp directory ${CONFIG} Set test variable ${tmpdir} - ${result} = Run Process ${RSPAMADM} --var\=CONFDIR\=${tmpdir} lua -b ${TESTDIR}/lua/rspamadm/test_dns_client.lua + ${result} = Run Process ${RSPAMADM} --var\=CONFDIR\=${tmpdir} lua -b ${RSPAMD_TESTDIR}/lua/rspamadm/test_dns_client.lua Log ${result.stdout} Log ${result.stderr} Should Be Equal As Integers ${result.rc} 0 @@ -39,8 +38,6 @@ DNS client *** Keywords *** Rspamadm test Setup - ${tmpdir} = Make Temporary Directory - Set Suite Variable ${TMPDIR} ${tmpdir} Run Dummy Http Run Redis @@ -52,7 +49,7 @@ Rspamadm test Teardown Run Dummy Http [Arguments] - ${result} = Start Process ${TESTDIR}/util/dummy_http.py + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_http.py Wait Until Created /tmp/dummy_http.pid Prepare temp directory @@ -63,4 +60,4 @@ Prepare temp directory ${config} = Replace Variables ${config} Log ${config} Create File ${tmpdir}/rspamd.conf ${config} - [Return] ${tmpdir}
\ No newline at end of file + [Return] ${tmpdir} diff --git a/test/functional/cases/160_antivirus.robot b/test/functional/cases/160_antivirus.robot index 8ad9d2bce..cac3a1893 100644 --- a/test/functional/cases/160_antivirus.robot +++ b/test/functional/cases/160_antivirus.robot @@ -1,28 +1,28 @@ *** Settings *** -Suite Setup Antivirus Setup +Suite Setup Rspamd Redis Setup Suite Teardown Antivirus Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${MESSAGE2} ${TESTDIR}/messages/freemail.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/antivirus.conf +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/freemail.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** CLAMAV MISS - Run Dummy Clam ${PORT_CLAM} + Run Dummy Clam ${RSPAMD_PORT_CLAM} Scan File ${MESSAGE} Do Not Expect Symbol CLAM_VIRUS Shutdown clamav CLAMAV HIT - Run Dummy Clam ${PORT_CLAM} 1 + Run Dummy Clam ${RSPAMD_PORT_CLAM} 1 Scan File ${MESSAGE2} Expect Symbol CLAM_VIRUS Do Not Expect Symbol CLAMAV_VIRUS_FAIL @@ -39,15 +39,15 @@ CLAMAV CACHE MISS Do Not Expect Symbol CLAMAV_VIRUS_FAIL FPROT MISS - Run Dummy Fprot ${PORT_FPROT} + Run Dummy Fprot ${RSPAMD_PORT_FPROT} Scan File ${MESSAGE2} Do Not Expect Symbol FPROT_VIRUS Do Not Expect Symbol FPROT_EICAR Shutdown fport FPROT HIT - PATTERN - Run Dummy Fprot ${PORT_FPROT} 1 - Run Dummy Fprot ${PORT_FPROT2_DUPLICATE} 1 /tmp/dummy_fprot_dupe.pid + Run Dummy Fprot ${RSPAMD_PORT_FPROT} 1 + Run Dummy Fprot ${RSPAMD_PORT_FPROT2_DUPLICATE} 1 /tmp/dummy_fprot_dupe.pid Scan File ${MESSAGE} Expect Symbol FPROT_EICAR Do Not Expect Symbol CLAMAV_VIRUS @@ -71,13 +71,13 @@ FPROT CACHE MISS Do Not Expect Symbol FPROT_VIRUS AVAST MISS - Run Dummy Avast ${PORT_AVAST} + Run Dummy Avast ${RSPAMD_PORT_AVAST} Scan File ${MESSAGE} Do Not Expect Symbol AVAST_VIRUS Shutdown avast AVAST HIT - Run Dummy Avast ${PORT_AVAST} 1 + Run Dummy Avast ${RSPAMD_PORT_AVAST} 1 Scan File ${MESSAGE2} Expect Symbol AVAST_VIRUS Do Not Expect Symbol AVAST_VIRUS_FAIL @@ -94,15 +94,8 @@ AVAST CACHE MISS Do Not Expect Symbol AVAST_VIRUS_FAIL *** Keywords *** -Antivirus Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/antivirus.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - Run Redis - Antivirus Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} + Rspamd Redis Teardown Shutdown clamav Shutdown fport Shutdown avast @@ -138,12 +131,12 @@ Run Dummy Run Dummy Clam [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_clamav.pid - Run Dummy ${TESTDIR}/util/dummy_clam.py ${port} ${found} ${pid} + Run Dummy ${RSPAMD_TESTDIR}/util/dummy_clam.py ${port} ${found} ${pid} Run Dummy Fprot [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_fprot.pid - Run Dummy ${TESTDIR}/util/dummy_fprot.py ${port} ${found} ${pid} + Run Dummy ${RSPAMD_TESTDIR}/util/dummy_fprot.py ${port} ${found} ${pid} Run Dummy Avast [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_avast.pid - Run Dummy ${TESTDIR}/util/dummy_avast.py ${port} ${found} ${pid} + Run Dummy ${RSPAMD_TESTDIR}/util/dummy_avast.py ${port} ${found} ${pid} diff --git a/test/functional/cases/161_p0f.robot b/test/functional/cases/161_p0f.robot index f3d7e7d8e..9b525d4e2 100644 --- a/test/functional/cases/161_p0f.robot +++ b/test/functional/cases/161_p0f.robot @@ -2,17 +2,17 @@ Suite Setup p0f Setup Suite Teardown p0f Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${MESSAGE2} ${TESTDIR}/messages/freemail.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/p0f.conf +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/freemail.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** p0f MISS @@ -24,7 +24,7 @@ p0f MISS Shutdown p0f p0f HIT - Run Dummy p0f ${P0F_SOCKET} windows + Run Dummy p0f ${RSPAMD_P0F_SOCKET} windows Scan File ${MESSAGE} IP=1.1.1.2 Do Not Expect Symbol P0F_FAIL Expect Symbol With Exact Options P0F link=Ethernet or modem distance=10 @@ -41,7 +41,7 @@ p0f MISS CACHE Do Not Expect Symbol P0F_FAIL p0f HIT CACHE - Run Dummy p0f ${P0F_SOCKET} windows + Run Dummy p0f ${RSPAMD_P0F_SOCKET} windows Scan File ${MESSAGE} IP=1.1.1.4 Expect Symbol WINDOWS Shutdown p0f @@ -58,21 +58,21 @@ p0f NO REDIS Shutdown p0f p0f NO MATCH - Run Dummy p0f ${P0F_SOCKET} windows no_match + Run Dummy p0f ${RSPAMD_P0F_SOCKET} windows no_match Scan File ${MESSAGE} IP=1.1.1.6 Do Not Expect Symbol P0F Do Not Expect Symbol WINDOWS Shutdown p0f p0f BAD QUERY - Run Dummy p0f ${P0F_SOCKET} windows bad_query + Run Dummy p0f ${RSPAMD_P0F_SOCKET} windows bad_query Scan File ${MESSAGE} IP=1.1.1.7 Expect Symbol With Exact Options P0F_FAIL Malformed Query: /tmp/p0f.sock Do Not Expect Symbol WINDOWS Shutdown p0f p0f BAD RESPONSE - Run Dummy p0f ${P0F_SOCKET} windows bad_response + Run Dummy p0f ${RSPAMD_P0F_SOCKET} windows bad_response Scan File ${MESSAGE} IP=1.1.1.8 Expect Symbol With Exact Options P0F_FAIL Error getting result: IO read error: connection terminated Do Not Expect Symbol WINDOWS @@ -80,14 +80,10 @@ p0f BAD RESPONSE *** Keywords *** p0f Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/p0f.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - Run Redis + Rspamd Redis Setup p0f Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} + Rspamd Redis Teardown Shutdown p0f Terminate All Processes kill=True @@ -96,6 +92,6 @@ Shutdown p0f Run Keyword if ${p0f_pid} Shutdown Process With Children ${p0f_pid} Run Dummy p0f - [Arguments] ${socket}=${P0F_SOCKET} ${os}=linux ${status}=ok - ${result} = Start Process ${TESTDIR}/util/dummy_p0f.py ${socket} ${os} ${status} + [Arguments] ${socket}=${RSPAMD_P0F_SOCKET} ${os}=linux ${status}=ok + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_p0f.py ${socket} ${os} ${status} Wait Until Created /tmp/dummy_p0f.pid diff --git a/test/functional/cases/162_url_redirector.robot b/test/functional/cases/162_url_redirector.robot index dd812b21e..1ebe713db 100644 --- a/test/functional/cases/162_url_redirector.robot +++ b/test/functional/cases/162_url_redirector.robot @@ -2,17 +2,17 @@ Suite Setup Urlredirector Setup Suite Teardown Urlredirector Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/redir.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${SETTINGS} {symbols_enabled=[URL_REDIRECTOR_CHECK]} -${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/url_redirector.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/redir.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat +${SETTINGS} {symbols_enabled=[URL_REDIRECTOR_CHECK]} *** Test Cases *** RESOLVE URLS @@ -26,26 +26,18 @@ RESOLVE URLS CACHED *** Keywords *** Urlredirector Setup - ${TMPDIR} = Make Temporary Directory - Set Suite Variable ${TMPDIR} - Set Suite Variable ${REDIS_TMPDIR} ${TMPDIR} - Run Redis Run Dummy Http - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/url_redirector.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG + Rspamd Redis Setup Urlredirector Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} + Rspamd Redis Teardown #Stop Dummy Http Terminate All Processes kill=True - Cleanup Temporary Directory ${REDIS_TMPDIR} Stop Dummy Http ${http_pid} = Get File /tmp/dummy_http.pid Shutdown Process With Children ${http_pid} Run Dummy Http - ${result} = Start Process ${TESTDIR}/util/dummy_http.py + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_http.py Wait Until Created /tmp/dummy_http.pid diff --git a/test/functional/cases/180_milter.robot b/test/functional/cases/180_milter.robot index ddbbf9799..be9a06466 100644 --- a/test/functional/cases/180_milter.robot +++ b/test/functional/cases/180_milter.robot @@ -1,14 +1,15 @@ *** Settings *** -Suite Setup Milter Setup -Suite Teardown Generic Teardown +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/milter.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** ACCEPT @@ -27,13 +28,10 @@ COMBINED TEST Milter Test combined.lua *** Keywords *** -Milter Setup - Generic Setup CONFIG=${TESTDIR}/configs/milter.conf - Milter Test [Arguments] ${mtlua} - ${result} = Run Process miltertest -Dport\=${PORT_PROXY} -Dhost\=${LOCAL_ADDR} -s ${TESTDIR}/lua/miltertest/${mtlua} - ... cwd=${TESTDIR}/lua/miltertest + ${result} = Run Process miltertest -Dport\=${RSPAMD_PORT_PROXY} -Dhost\=${RSPAMD_LOCAL_ADDR} -s ${RSPAMD_TESTDIR}/lua/miltertest/${mtlua} + ... cwd=${RSPAMD_TESTDIR}/lua/miltertest Should Match Regexp ${result.stderr} ^$ Log ${result.rc} Log ${result.stdout} diff --git a/test/functional/cases/210_clickhouse/001_migration.robot b/test/functional/cases/210_clickhouse/001_migration.robot index 19d99559f..b1648b090 100644 --- a/test/functional/cases/210_clickhouse/001_migration.robot +++ b/test/functional/cases/210_clickhouse/001_migration.robot @@ -2,13 +2,13 @@ Documentation Checks if rspamd is able to upgrade migration schema from v0 (very initial) to v2 Test Setup Clickhouse Setup Test Teardown Clickhosue Teardown -Variables ${TESTDIR}/lib/vars.py -Library ${TESTDIR}/lib/rspamd.py +Variables ${RSPAMD_TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py Library clickhouse.py -Resource ${TESTDIR}/lib/rspamd.robot +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot *** Variables *** -${CONFIG} ${TESTDIR}/configs/clickhouse.conf +${CONFIG} ${RSPAMD_TESTDIR}/configs/clickhouse.conf ${RSPAMD_SCOPE} Suite ${CLICKHOUSE_PORT} ${18123} @@ -22,13 +22,13 @@ ${CLICKHOUSE_PORT} ${18123} # Column should exist rspamd Attachments.Digest # Column should exist rspamd Symbols.Scores # Schema version should be 3 -# Upload new schema ${TESTDIR}/data/initial_schema/schema.sql -# Insert data rspamd ${TESTDIR}/data/initial_schema/data.rspamd.sql -# Insert data rspamd_asn ${TESTDIR}/data/initial_schema/data.rspamd_asn.sql -# Insert data rspamd_urls ${TESTDIR}/data/initial_schema/data.rspamd_urls.sql -# Insert data rspamd_emails ${TESTDIR}/data/initial_schema/data.rspamd_emails.sql -# Insert data rspamd_symbols ${TESTDIR}/data/initial_schema/data.rspamd_symbols.sql -# Insert data rspamd_attachments ${TESTDIR}/data/initial_schema/data.rspamd_attachments.sql +# Upload new schema ${RSPAMD_TESTDIR}/data/initial_schema/schema.sql +# Insert data rspamd ${RSPAMD_TESTDIR}/data/initial_schema/data.rspamd.sql +# Insert data rspamd_asn ${RSPAMD_TESTDIR}/data/initial_schema/data.rspamd_asn.sql +# Insert data rspamd_urls ${RSPAMD_TESTDIR}/data/initial_schema/data.rspamd_urls.sql +# Insert data rspamd_emails ${RSPAMD_TESTDIR}/data/initial_schema/data.rspamd_emails.sql +# Insert data rspamd_symbols ${RSPAMD_TESTDIR}/data/initial_schema/data.rspamd_symbols.sql +# Insert data rspamd_attachments ${RSPAMD_TESTDIR}/data/initial_schema/data.rspamd_attachments.sql # Prepare rspamd # Sleep 2 #TODO: replace this check with waiting until migration finishes # Column should exist rspamd Symbols.Scores @@ -43,8 +43,8 @@ ${CLICKHOUSE_PORT} ${18123} # Eventually broken #Retention -# Upload new schema ${TESTDIR}/data/schema_2/schema.sql -# Insert data rspamd ${TESTDIR}/data/schema_2/data.rspamd.sql +# Upload new schema ${RSPAMD_TESTDIR}/data/schema_2/schema.sql +# Insert data rspamd ${RSPAMD_TESTDIR}/data/schema_2/data.rspamd.sql # Assert rows count rspamd 56 # Prepare rspamd # Sleep 2 #TODO: replace this check with waiting until migration finishes @@ -52,31 +52,31 @@ ${CLICKHOUSE_PORT} ${18123} *** Keywords *** Clickhouse Setup - ${TMPDIR} = Make Temporary Directory - Set Suite Variable ${TMPDIR} - Set Directory Ownership ${TMPDIR} ${RSPAMD_USER} ${RSPAMD_GROUP} - ${template} = Get File ${TESTDIR}/configs/clickhouse-config.xml + ${RSPAMD_TMPDIR} = Make Temporary Directory + Set Suite Variable ${RSPAMD_TMPDIR} + Set Directory Ownership ${RSPAMD_TMPDIR} ${RSPAMD_USER} ${RSPAMD_GROUP} + ${template} = Get File ${RSPAMD_TESTDIR}/configs/clickhouse-config.xml ${config} = Replace Variables ${template} - Create File ${TMPDIR}/clickhouse-config.xml ${config} - Copy File ${TESTDIR}/configs/clickhouse-users.xml ${TMPDIR}/users.xml - Create Directory ${TMPDIR}/clickhouse - Set Directory Ownership ${TMPDIR}/clickhouse clickhouse clickhouse + Create File ${RSPAMD_TMPDIR}/clickhouse-config.xml ${config} + Copy File ${RSPAMD_TESTDIR}/configs/clickhouse-users.xml ${RSPAMD_TMPDIR}/users.xml + Create Directory ${RSPAMD_TMPDIR}/clickhouse + Set Directory Ownership ${RSPAMD_TMPDIR}/clickhouse clickhouse clickhouse ${result} = Run Process su -s /bin/sh clickhouse -c - ... clickhouse-server --daemon --config-file\=${TMPDIR}/clickhouse-config.xml --pid-file\=${TMPDIR}/clickhouse/clickhouse.pid + ... clickhouse-server --daemon --config-file\=${RSPAMD_TMPDIR}/clickhouse-config.xml --pid-file\=${RSPAMD_TMPDIR}/clickhouse/clickhouse.pid Run Keyword If ${result.rc} != 0 Log ${result.stderr} Should Be Equal As Integers ${result.rc} 0 Wait Until Keyword Succeeds 5 sec 50 ms TCP Connect localhost ${CLICKHOUSE_PORT} - Set Suite Variable ${TMPDIR} ${TMPDIR} + Set Suite Variable ${RSPAMD_TMPDIR} ${RSPAMD_TMPDIR} Clickhosue Teardown # Sleep 30 - ${clickhouse_pid} = Get File ${TMPDIR}/clickhouse/clickhouse.pid + ${clickhouse_pid} = Get File ${RSPAMD_TMPDIR}/clickhouse/clickhouse.pid Shutdown Process With Children ${clickhouse_pid} - Log File ${TMPDIR}/clickhouse/clickhouse-server.err.log - Simple Teardown + Log File ${RSPAMD_TMPDIR}/clickhouse/clickhouse-server.err.log + Rspamd Teardown Prepare rspamd - &{d} = Run Rspamd CONFIG=${TESTDIR}/configs/clickhouse.conf TMPDIR=${TMPDIR} + &{d} = Run Rspamd CONFIG=${RSPAMD_TESTDIR}/configs/clickhouse.conf TMPDIR=${RSPAMD_TMPDIR} ${keys} = Get Dictionary Keys ${d} FOR ${i} IN @{keys} Run Keyword If '${RSPAMD_SCOPE}' == 'Suite' Set Suite Variable ${${i}} ${d}[${i}] diff --git a/test/functional/cases/220_http.robot b/test/functional/cases/220_http.robot index d6573a3eb..690222855 100644 --- a/test/functional/cases/220_http.robot +++ b/test/functional/cases/220_http.robot @@ -2,16 +2,16 @@ Test Setup Http Setup Test Teardown Http Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -# ${CONFIG} ${TESTDIR}/configs/http.conf -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${CONFIG} ${TESTDIR}/configs/lua_test.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Test +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/http.lua +${RSPAMD_SCOPE} Test +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Simple HTTP request @@ -40,29 +40,24 @@ SSL Large HTTP request Expect Symbol HTTP_SSL_LARGE *** Keywords *** -Lua Setup - [Arguments] ${LUA_SCRIPT} - Set Suite Variable ${LUA_SCRIPT} - Generic Setup - Http Setup Run Dummy Http Run Dummy Https - Lua Setup ${TESTDIR}/lua/http.lua + Rspamd Setup Http Teardown ${http_pid} = Get File /tmp/dummy_http.pid Shutdown Process With Children ${http_pid} ${https_pid} = Get File /tmp/dummy_https.pid Shutdown Process With Children ${https_pid} - Normal Teardown + Rspamd Teardown Run Dummy Http - ${result} = Start Process ${TESTDIR}/util/dummy_http.py + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_http.py Wait Until Created /tmp/dummy_http.pid Run Dummy Https - ${result} = Start Process ${TESTDIR}/util/dummy_https.py ${TESTDIR}/util/server.pem + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_https.py ${RSPAMD_TESTDIR}/util/server.pem Wait Until Created /tmp/dummy_https.pid Check url diff --git a/test/functional/cases/230_tcp.robot b/test/functional/cases/230_tcp.robot index 3d9aba126..f44bdda15 100644 --- a/test/functional/cases/230_tcp.robot +++ b/test/functional/cases/230_tcp.robot @@ -2,16 +2,16 @@ Suite Setup Servers Setup Suite Teardown Servers Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -# ${CONFIG} ${TESTDIR}/configs/http.conf -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${CONFIG} ${TESTDIR}/configs/lua_test.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Suite +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/tcp.lua +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Simple TCP request @@ -44,31 +44,26 @@ Sync API TCP post request Check url /content-length post HTTP_SYNC_CONTENT_post hello post *** Keywords *** -Lua Setup - [Arguments] ${LUA_SCRIPT} - Set Suite Variable ${LUA_SCRIPT} - Generic Setup - Servers Setup Run Dummy Http Run Dummy Ssl - Lua Setup ${TESTDIR}/lua/tcp.lua + Rspamd Setup Servers Teardown ${http_pid} = Get File /tmp/dummy_http.pid Shutdown Process With Children ${http_pid} ${ssl_pid} = Get File /tmp/dummy_ssl.pid Shutdown Process With Children ${ssl_pid} - Normal Teardown + Rspamd Teardown Run Dummy Http [Arguments] - ${result} = Start Process ${TESTDIR}/util/dummy_http.py + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_http.py Wait Until Created /tmp/dummy_http.pid timeout=2 second Run Dummy Ssl [Arguments] - ${result} = Start Process ${TESTDIR}/util/dummy_ssl.py ${TESTDIR}/util/server.pem + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_ssl.py ${RSPAMD_TESTDIR}/util/server.pem Wait Until Created /tmp/dummy_ssl.pid timeout=2 second Check url diff --git a/test/functional/cases/231_tcp_down.robot b/test/functional/cases/231_tcp_down.robot index e68e2053a..3403be6ae 100644 --- a/test/functional/cases/231_tcp_down.robot +++ b/test/functional/cases/231_tcp_down.robot @@ -1,17 +1,17 @@ *** Settings *** -Test Setup Http Setup -Test Teardown Http Teardown +Test Setup Rspamd Setup +Test Teardown Rspamd Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -# ${CONFIG} ${TESTDIR}/configs/http.conf -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${CONFIG} ${TESTDIR}/configs/lua_test.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Test +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/tcp.lua +${RSPAMD_SCOPE} Test +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** @@ -23,17 +23,6 @@ Sync API TCP get request when server is down *** Keywords *** -Lua Setup - [Arguments] ${LUA_SCRIPT} - Set Suite Variable ${LUA_SCRIPT} - Generic Setup - -Http Setup - Lua Setup ${TESTDIR}/lua/tcp.lua - -Http Teardown - Normal Teardown - Check url [Arguments] ${url} ${method} @{expect_results} ${result} = Scan Message With Rspamc --header=url:${url} --header=method:${method} ${MESSAGE} diff --git a/test/functional/cases/240_redis.robot b/test/functional/cases/240_redis.robot index 169523330..18babdc79 100644 --- a/test/functional/cases/240_redis.robot +++ b/test/functional/cases/240_redis.robot @@ -1,19 +1,20 @@ *** Settings *** -Test Setup Redis Setup -Test Teardown Redis Teardown +Test Setup Rspamd Redis Setup +Test Teardown Rspamd Redis Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py Suite Teardown Terminate All Processes kill=True *** Variables *** -${REDIS_SCOPE} Test -${RSPAMD_SCOPE} Test -${CONFIG} ${TESTDIR}/configs/plugins.conf -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${MESSAGE} ${TESTDIR}/messages/spam_message.eml +${CONFIG} ${RSPAMD_TESTDIR}/configs/redis.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${REDIS_SCOPE} Test +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/redis.lua +${RSPAMD_SCOPE} Test +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** @@ -23,19 +24,3 @@ Redis client Expect Symbol With Exact Options REDIS hello from lua on redis Expect Symbol With Exact Options REDIS_ASYNC test value Expect Symbol With Exact Options REDIS_ASYNC201809 test value - -*** Keywords *** -Lua Setup - [Arguments] ${LUA_SCRIPT} - Set Suite Variable ${LUA_SCRIPT} - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/redis.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -Redis Setup - Lua Setup ${TESTDIR}/lua/redis.lua - Run Redis - -Redis Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} diff --git a/test/functional/cases/241_redis_is_dead.robot b/test/functional/cases/241_redis_is_dead.robot index 223ada965..1ff2765a7 100644 --- a/test/functional/cases/241_redis_is_dead.robot +++ b/test/functional/cases/241_redis_is_dead.robot @@ -1,21 +1,22 @@ *** Settings *** Documentation Test the case when trying to connect to nowhere ... (i.e. redis is not running) -Test Setup Redis Setup -Test Teardown Redis Teardown +Test Setup Rspamd Setup +Test Teardown Rspamd Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py Suite Teardown Terminate All Processes kill=True *** Variables *** -${REDIS_SCOPE} Test -${RSPAMD_SCOPE} Test -${CONFIG} ${TESTDIR}/configs/plugins.conf -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${MESSAGE} ${TESTDIR}/messages/spam_message.eml +${CONFIG} ${RSPAMD_TESTDIR}/configs/redis.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${REDIS_SCOPE} Test +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/redis.lua +${RSPAMD_SCOPE} Test +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** @@ -24,18 +25,3 @@ Dead Redis client Expect Symbol With Exact Options REDIS_ERROR_3 Connection refused Expect Symbol With Exact Options REDIS_ASYNC201809_ERROR Connection refused Expect Symbol With Exact Options REDIS_ASYNC_ERROR Connection refused - -*** Keywords *** -Lua Setup - [Arguments] ${LUA_SCRIPT} - Set Suite Variable ${LUA_SCRIPT} - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/redis.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -Redis Setup - Lua Setup ${TESTDIR}/lua/redis.lua - -Redis Teardown - Normal Teardown -# Shutdown Process With Children ${REDIS_PID} diff --git a/test/functional/cases/250_dns.robot b/test/functional/cases/250_dns.robot index fa13d6d10..8c6a422ec 100644 --- a/test/functional/cases/250_dns.robot +++ b/test/functional/cases/250_dns.robot @@ -1,16 +1,17 @@ *** Settings *** -Test Setup Http Setup -Test Teardown Http Teardown +Test Setup Rspamd Setup +Test Teardown Rspamd Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${CONFIG} ${TESTDIR}/configs/lua_test.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Test +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/dns.lua +${RSPAMD_SCOPE} Test +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Simple DNS request @@ -22,15 +23,3 @@ Faulty DNS request Scan File ${MESSAGE} To-Resolve=not-resolvable.com Expect Symbol With Exact Options DNS_SYNC_ERROR requested record is not found Expect Symbol With Exact Options DNS_ERROR requested record is not found - -*** Keywords *** -Lua Setup - [Arguments] ${LUA_SCRIPT} - Set Suite Variable ${LUA_SCRIPT} - Generic Setup - -Http Setup - Lua Setup ${TESTDIR}/lua/dns.lua - -Http Teardown - Normal Teardown diff --git a/test/functional/cases/260_regex.robot b/test/functional/cases/260_regex.robot index f19e389a0..5cf48fe18 100644 --- a/test/functional/cases/260_regex.robot +++ b/test/functional/cases/260_regex.robot @@ -1,16 +1,16 @@ *** Settings *** -Test Setup Regex Setup -Test Teardown Regex Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Test Setup Rspamd Setup +Test Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/newlines.eml -${UTF_MESSAGE} ${TESTDIR}/messages/utf.eml -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${RSPAMD_SCOPE} Test +${CONFIG} ${RSPAMD_TESTDIR}/configs/regexp.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/newlines.eml +${RSPAMD_SCOPE} Test +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat +${UTF_MESSAGE} ${RSPAMD_TESTDIR}/messages/utf.eml *** Test Cases *** @@ -26,13 +26,3 @@ Newlines Expect Symbol With Option FOUND_URL https://google.com/maps/ Expect Symbol With Option FOUND_URL https://www.google.com/search?q\=hello world&oq\=hello world&aqs\=chrome..69i57j0l5.3045j0j7&sourceid\=chrome&ie\=UTF-8 Expect Symbol With Option FOUND_URL https://github.com/google/sanitizers/wiki/AddressSanitizer - - -*** Keywords *** -Regex Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/regexp.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -Regex Teardown - Normal Teardown diff --git a/test/functional/cases/270_selector.robot b/test/functional/cases/270_selector.robot index bf74a327e..683d53d0b 100644 --- a/test/functional/cases/270_selector.robot +++ b/test/functional/cases/270_selector.robot @@ -1,16 +1,16 @@ *** Settings *** -Test Setup Regex Setup -Test Teardown Regex Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Test Setup Rspamd Setup +Test Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/subject1.eml -${UTF_MESSAGE} ${TESTDIR}/messages/utf.eml -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${RSPAMD_SCOPE} Test +${CONFIG} ${RSPAMD_TESTDIR}/configs/selector.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/subject1.eml +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat +${UTF_MESSAGE} ${RSPAMD_TESTDIR}/messages/utf.eml *** Test Cases *** @@ -19,12 +19,3 @@ Newlines Expect Symbol CONFIG_SELECTOR_RE_RCPT_SUBJECT Expect Symbol LUA_SELECTOR_RE - -*** Keywords *** -Regex Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/selector.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -Regex Teardown - Normal Teardown diff --git a/test/functional/cases/280_rules.robot b/test/functional/cases/280_rules.robot index ec8e12fb2..fe0efa357 100644 --- a/test/functional/cases/280_rules.robot +++ b/test/functional/cases/280_rules.robot @@ -1,23 +1,23 @@ *** Settings *** -Suite Setup Rules Setup -Suite Teardown Rules Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${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 -${MESSAGE5} ${TESTDIR}/messages/badboundary.eml -${MESSAGE6} ${TESTDIR}/messages/pdf_encrypted.eml -${MESSAGE7} ${TESTDIR}/messages/pdf_js.eml -${MESSAGE8} ${TESTDIR}/messages/yand_forward.eml -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${RSPAMD_SCOPE} Suite +${CONFIG} ${RSPAMD_TESTDIR}/configs/regexp.conf +${MESSAGE1} ${RSPAMD_TESTDIR}/messages/fws_fn.eml +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/fws_fp.eml +${MESSAGE3} ${RSPAMD_TESTDIR}/messages/fws_tp.eml +${MESSAGE4} ${RSPAMD_TESTDIR}/messages/broken_richtext.eml +${MESSAGE5} ${RSPAMD_TESTDIR}/messages/badboundary.eml +${MESSAGE6} ${RSPAMD_TESTDIR}/messages/pdf_encrypted.eml +${MESSAGE7} ${RSPAMD_TESTDIR}/messages/pdf_js.eml +${MESSAGE8} ${RSPAMD_TESTDIR}/messages/yand_forward.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/newlines.eml +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** @@ -57,27 +57,27 @@ PDF javascript Expect Symbol PDF_JAVASCRIPT BITCOIN ADDR - Scan File ${TESTDIR}/messages/btc.eml + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml Expect Symbol BITCOIN_ADDR BITCOIN ADDR 2 - Scan File ${TESTDIR}/messages/btc2.eml + Scan File ${RSPAMD_TESTDIR}/messages/btc2.eml Expect Symbol BITCOIN_ADDR BITCOIN ADDR 3 - Scan File ${TESTDIR}/messages/btc3.eml + Scan File ${RSPAMD_TESTDIR}/messages/btc3.eml Expect Symbol BITCOIN_ADDR RCVD_COUNT_ONE - Scan File ${TESTDIR}/messages/btc.eml + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml Expect Symbol RCVD_COUNT_ONE RCVD_COUNT_FIVE - Scan File ${TESTDIR}/messages/yand_forward.eml + Scan File ${RSPAMD_TESTDIR}/messages/yand_forward.eml Expect Symbol RCVD_COUNT_FIVE RCVD_COUNT_SEVEN - Scan File ${TESTDIR}/messages/rcvd7.eml + Scan File ${RSPAMD_TESTDIR}/messages/rcvd7.eml Expect Symbol RCVD_COUNT_SEVEN FROM_NEQ_ENVFROM @@ -85,41 +85,32 @@ FROM_NEQ_ENVFROM Expect Symbol FROM_NEQ_ENVFROM PHISH_SENDER_A - Scan File ${TESTDIR}/messages/phish_sender.eml + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender.eml Expect Symbol With Score And Exact Options MULTIPLE_FROM 9.0 <any@attack.com> <admin@legitimate.com> Expect Symbol With Score And Exact Options MULTIPLE_UNIQUE_HEADERS 7.0 From PHISH_SENDER_B - Scan File ${TESTDIR}/messages/phish_sender2.eml + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender2.eml Expect Symbol BROKEN_HEADERS PHISH_SENDER_C - Scan File ${TESTDIR}/messages/phish_sender3.eml + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender3.eml Expect Symbol BROKEN_HEADERS PHISH_SENDER_D - Scan File ${TESTDIR}/messages/phish_sender4.eml + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender4.eml Expect Symbol BROKEN_HEADERS PHISH_SENDER_E - Scan File ${TESTDIR}/messages/phish_sender5.eml + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender5.eml Expect Symbol MULTIPLE_FROM Expect Symbol With Exact Options DMARC_NA Duplicate From header PHISH_SENDER_ROUTING_PART - Scan File ${TESTDIR}/messages/phish_sender6.eml + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender6.eml Expect Symbol FROM_INVALID REPLYTO_ADDR_EQ_FROM - Scan File ${TESTDIR}/messages/replyto_addr_eq_from.eml + Scan File ${RSPAMD_TESTDIR}/messages/replyto_addr_eq_from.eml Expect Symbol REPLYTO_ADDR_EQ_FROM - -*** Keywords *** -Rules Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/regexp.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -Rules Teardown - Normal Teardown diff --git a/test/functional/cases/281_fnames.robot b/test/functional/cases/281_fnames.robot index b76544d97..399127de8 100644 --- a/test/functional/cases/281_fnames.robot +++ b/test/functional/cases/281_fnames.robot @@ -1,30 +1,19 @@ *** Settings *** -Suite Setup Fnames Setup -Suite Teardown Fnames Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/lua_script.conf -${LUA_SCRIPT} ${TESTDIR}/lua/test_fname.lua -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_script.conf +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/test_fname.lua +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** FILE NAMES - Scan File ${TESTDIR}/messages/fname.eml + Scan File ${RSPAMD_TESTDIR}/messages/fname.eml Expect Symbol With Option TEST_FNAME [삼성생명]2020.08.14 데일리 경제뉴스.pdf Expect Symbol With Option TEST_FNAME 01029_402110_10620_RGT06902_PRT180ML_20200803_101820.pdf - - -*** Keywords *** -Fnames Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/regexp.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -Fnames Teardown - Normal Teardown - Terminate All Processes kill=True diff --git a/test/functional/cases/290_greylist.robot b/test/functional/cases/290_greylist.robot index 8b746bc0f..24385b5d5 100644 --- a/test/functional/cases/290_greylist.robot +++ b/test/functional/cases/290_greylist.robot @@ -1,16 +1,16 @@ *** Settings *** -Suite Setup Greylist Setup -Suite Teardown Greylist Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Redis Setup +Suite Teardown Rspamd Redis Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/greylist.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** GREYLIST NEW @@ -25,15 +25,3 @@ GREYLIST PASS Sleep 4s Wait greylisting timeout Scan File ${MESSAGE} Expect Symbol With Option GREYLIST pass - -*** Keywords *** -Greylist Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/greylist.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - Run Redis - -Greylist Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} - Terminate All Processes kill=True diff --git a/test/functional/cases/300_rbl.robot b/test/functional/cases/300_rbl.robot index 55f46e5fd..82565bcb7 100644 --- a/test/functional/cases/300_rbl.robot +++ b/test/functional/cases/300_rbl.robot @@ -1,15 +1,15 @@ *** Settings *** -Suite Setup Rbl Setup -Suite Teardown Rbl Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/rbl.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** RBL FROM MISS @@ -39,19 +39,19 @@ RBL FROM HIT WL Expect Symbol With Exact Options FAKE_WL_RBL_CODE_2 4.3.2.4:from EMAILBL Compose Map 1 - Scan File ${TESTDIR}/messages/url14.eml + Scan File ${RSPAMD_TESTDIR}/messages/url14.eml Expect Symbol With Exact Options RSPAMD_EMAILBL dirty.sanchez.com:email EMAILBL Compose Map 2 - Scan File ${TESTDIR}/messages/url15.eml + Scan File ${RSPAMD_TESTDIR}/messages/url15.eml Expect Symbol With Exact Options RSPAMD_EMAILBL very.dirty.sanchez.com:email EMAILBL Compose Map 3 - Scan File ${TESTDIR}/messages/url16.eml + Scan File ${RSPAMD_TESTDIR}/messages/url16.eml Expect Symbol With Exact Options RSPAMD_EMAILBL 41.black.sanchez.com:email CONTENT URLS - Scan File ${TESTDIR}/messages/content_url.eml + Scan File ${RSPAMD_TESTDIR}/messages/content_url.eml Expect Symbol With Exact Options URIBL_NOCONTENT example.org:url Expect Symbol With Option URIBL_WITHCONTENT example.com:url Expect Symbol With Option URIBL_WITHCONTENT example.org:url @@ -59,22 +59,12 @@ CONTENT URLS Expect Symbol With Exact Options URIBL_CONTENTONLY example.com:url SELECTORS - Scan File ${TESTDIR}/messages/btc.eml From=user@example.com Helo=example.org + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml From=user@example.com Helo=example.org Expect Symbol With Exact Options RBL_SELECTOR_SINGLE example.org:selector Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.com:sel_from Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_helo SELECTORS COMBINED - Scan File ${TESTDIR}/messages/btc.eml From=user@example.org Helo=example.org + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml From=user@example.org Helo=example.org Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_from Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_helo - -*** Keywords *** -Rbl Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/rbl.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -Rbl Teardown - Normal Teardown - Terminate All Processes kill=True diff --git a/test/functional/cases/310_udp.robot b/test/functional/cases/310_udp.robot index 3da02729b..d5486a030 100644 --- a/test/functional/cases/310_udp.robot +++ b/test/functional/cases/310_udp.robot @@ -2,15 +2,16 @@ Test Setup UDP Setup Test Teardown UDP Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${CONFIG} ${TESTDIR}/configs/lua_test.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Test +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/udp.lua +${RSPAMD_SCOPE} Test +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Simple UDP request @@ -26,21 +27,16 @@ Errored UDP request Expect Symbol With Exact Options UDP_FAIL read timeout *** Keywords *** -Lua Setup - [Arguments] ${LUA_SCRIPT} - Set Suite Variable ${LUA_SCRIPT} - Generic Setup - UDP Setup Run Dummy UDP - Lua Setup ${TESTDIR}/lua/udp.lua + Rspamd Setup UDP Teardown ${udp_pid} = Get File /tmp/dummy_udp.pid Shutdown Process With Children ${udp_pid} - Normal Teardown + Rspamd Teardown Run Dummy UDP [Arguments] - ${result} = Start Process ${TESTDIR}/util/dummy_udp.py 5005 + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_udp.py 5005 Wait Until Created /tmp/dummy_udp.pid diff --git a/test/functional/cases/320_arc_signing/001_simple.robot b/test/functional/cases/320_arc_signing/001_simple.robot index 73623574b..10078c68b 100644 --- a/test/functional/cases/320_arc_signing/001_simple.robot +++ b/test/functional/cases/320_arc_signing/001_simple.robot @@ -1,17 +1,17 @@ *** Settings *** -Suite Setup ARC Signing Setup -Suite Teardown ARC Signing Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/dmarc/fail_none.eml -${MESSAGE_FAIL} ${TESTDIR}/messages/dmarc/fail_none1.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/arc_signing/simple.conf +${MESSAGE_FAIL} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none1.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** TEST SIGNED @@ -29,12 +29,3 @@ TEST NOT SIGNED - USERNAME WRONG DOMAIN TEST NOT SIGNED - USERNAME WRONG PUBKEY ${result} = Scan Message With Rspamc ${MESSAGE_FAIL} -u bob@invalid.za.org Should Not Contain ${result.stdout} ARC_SIGNED - -*** Keywords *** -ARC Signing Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/arc_signing/simple.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -ARC Signing Teardown - Normal Teardown diff --git a/test/functional/cases/320_arc_signing/002_redis.robot b/test/functional/cases/320_arc_signing/002_redis.robot index 2fde59164..ca979adea 100644 --- a/test/functional/cases/320_arc_signing/002_redis.robot +++ b/test/functional/cases/320_arc_signing/002_redis.robot @@ -1,16 +1,16 @@ *** Settings *** Suite Setup ARC Signing Setup -Suite Teardown ARC Signing Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Teardown Rspamd Redis Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${MESSAGE} ${TESTDIR}/messages/dmarc/fail_none.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/arc_signing/redis.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** TEST SIGNED @@ -23,14 +23,7 @@ TEST NOT SIGNED - USERNAME WRONG DOMAIN *** Keywords *** ARC Signing Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/arc_signing/redis.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - Run Redis + Rspamd Redis Setup Redis HSET TEST_DKIM_SELECTORS cacophony.za.org arc - ${key} = Get File ${TESTDIR}/configs/dkim.key + ${key} = Get File ${RSPAMD_TESTDIR}/configs/dkim.key Redis HSET TEST_DKIM_KEYS arc.cacophony.za.org ${key} - -ARC Signing Teardown - Normal Teardown - Shutdown Process With Children ${REDIS_PID} diff --git a/test/functional/cases/321_arc_check.robot b/test/functional/cases/321_arc_check.robot index 6cbc00b44..1a22eda9e 100644 --- a/test/functional/cases/321_arc_check.robot +++ b/test/functional/cases/321_arc_check.robot @@ -1,27 +1,21 @@ *** Settings *** -Suite Setup ARC Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/arc.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat *** Test Cases *** ARC ALLOW CHECK - Scan File ${TESTDIR}/messages/arcallow.eml + Scan File ${RSPAMD_TESTDIR}/messages/arcallow.eml Expect Symbol ARC_ALLOW ARC BAD CHECK - Scan File ${TESTDIR}/messages/arcbad.eml + Scan File ${RSPAMD_TESTDIR}/messages/arcbad.eml Expect Symbol ARC_INVALID - -*** Keywords *** -ARC Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/arc.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/330_neural/001_autotrain.robot b/test/functional/cases/330_neural/001_autotrain.robot index 8ce342838..a267416ff 100644 --- a/test/functional/cases/330_neural/001_autotrain.robot +++ b/test/functional/cases/330_neural/001_autotrain.robot @@ -1,17 +1,17 @@ *** Settings *** -Suite Setup Neural Setup -Suite Teardown Neural Teardown +Suite Setup Rspamd Redis Setup +Suite Teardown Rspamd Redis Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${CONFIG} ${TESTDIR}/configs/neural.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite +${CONFIG} ${RSPAMD_TESTDIR}/configs/neural.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Train @@ -61,14 +61,3 @@ Check Neural SPAM INVERSE Expect Symbol NEURAL_HAM_SHORT_PCA Do Not Expect Symbol NEURAL_SPAM_SHORT Do Not Expect Symbol NEURAL_SPAM_SHORT_PCA - -*** Keywords *** -Neural Setup - ${TMPDIR} = Make Temporary Directory - Set Suite Variable ${TMPDIR} - Run Redis - Generic Setup - -Neural Teardown - Shutdown Process With Children ${REDIS_PID} - Normal Teardown diff --git a/test/functional/cases/330_neural/002_manualtrain.robot b/test/functional/cases/330_neural/002_manualtrain.robot index 22a42120e..ecee7f631 100644 --- a/test/functional/cases/330_neural/002_manualtrain.robot +++ b/test/functional/cases/330_neural/002_manualtrain.robot @@ -1,17 +1,17 @@ *** Settings *** -Suite Setup Neural Setup -Suite Teardown Neural Teardown +Suite Setup Rspamd Redis Setup +Suite Teardown Rspamd Redis Teardown Library Process -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${CONFIG} ${TESTDIR}/configs/neural_noauto.conf -${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite +${CONFIG} ${RSPAMD_TESTDIR}/configs/neural_noauto.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${REDIS_SCOPE} Suite +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Collect training vectors & train manually @@ -25,9 +25,9 @@ Collect training vectors & train manually # Save neural inputs for later ${HAM_ROW} = Get File ${SCAN_RESULT}[symbols][SAVE_NN_ROW][options][0] Remove File ${SCAN_RESULT}[symbols][SAVE_NN_ROW][options][0] - ${HAM_ROW} = Run ${RSPAMADM} lua -a ${HAM_ROW} ${TESTDIR}/util/nn_unpack.lua + ${HAM_ROW} = Run ${RSPAMADM} lua -a ${HAM_ROW} ${RSPAMD_TESTDIR}/util/nn_unpack.lua ${HAM_ROW} = Evaluate json.loads("${HAM_ROW}") - ${SPAM_ROW} = Run ${RSPAMADM} lua -a ${SPAM_ROW} ${TESTDIR}/util/nn_unpack.lua + ${SPAM_ROW} = Run ${RSPAMADM} lua -a ${SPAM_ROW} ${RSPAMD_TESTDIR}/util/nn_unpack.lua ${SPAM_ROW} = Evaluate json.loads("${SPAM_ROW}") ${HAM_VEC} = Evaluate [${HAM_ROW}] * 10 ${SPAM_VEC} = Evaluate [${SPAM_ROW}] * 10 @@ -35,7 +35,7 @@ Collect training vectors & train manually # Save variables for use in inverse training Set Suite Variable ${HAM_VEC} Set Suite Variable ${SPAM_VEC} - HTTP POST ${LOCAL_ADDR} ${PORT_CONTROLLER} /plugins/neural/learn ${json1} + HTTP POST ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_CONTROLLER} /plugins/neural/learn ${json1} Sleep 2s Wait for neural to be loaded Check Neural HAM @@ -50,7 +50,7 @@ Check Neural SPAM Train inverse ${json2} = Evaluate json.dumps({"spam_vec": ${HAM_VEC}, "ham_vec": ${SPAM_VEC}, "rule": "SHORT"}) - HTTP POST ${LOCAL_ADDR} ${PORT_CONTROLLER} /plugins/neural/learn ${json2} + HTTP POST ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_CONTROLLER} /plugins/neural/learn ${json2} Sleep 2s Wait for neural to be loaded Check Neural HAM - inverse @@ -62,14 +62,3 @@ Check Neural SPAM - inverse Scan File ${MESSAGE} Settings={symbols_enabled = ["SPAM_SYMBOL"];groups_enabled=["neural"];symbols_disabled = ["NEURAL_LEARN"]} Do Not Expect Symbol NEURAL_SPAM_SHORT Expect Symbol NEURAL_HAM_SHORT - -*** Keywords *** -Neural Setup - ${TMPDIR} = Make Temporary Directory - Set Suite Variable ${TMPDIR} - Run Redis - Generic Setup - -Neural Teardown - Shutdown Process With Children ${REDIS_PID} - Normal Teardown diff --git a/test/functional/cases/340_surbl.robot b/test/functional/cases/340_surbl.robot index 904594126..faf4a92c2 100644 --- a/test/functional/cases/340_surbl.robot +++ b/test/functional/cases/340_surbl.robot @@ -1,45 +1,45 @@ *** Settings *** -Suite Setup Surbl Setup -Suite Teardown Surbl Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/surbl.conf +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** SURBL resolve ip - Scan File ${TESTDIR}/messages/url7.eml + Scan File ${RSPAMD_TESTDIR}/messages/url7.eml Expect Symbol With Exact Options URIBL_SBL_CSS 8.8.8.9:example.ru:url Expect Symbol With Exact Options URIBL_XBL 8.8.8.8:example.ru:url Expect Symbol With Exact Options URIBL_PBL 8.8.8.8:example.ru:url SURBL Example.com domain - Scan File ${TESTDIR}/messages/url4.eml + Scan File ${RSPAMD_TESTDIR}/messages/url4.eml Expect Symbol RSPAMD_URIBL Expect Symbol DBL_SPAM Do Not Expect Symbol DBL_PHISH Do Not Expect Symbol URIBL_BLACK SURBL Example.net domain - Scan File ${TESTDIR}/messages/url5.eml + Scan File ${RSPAMD_TESTDIR}/messages/url5.eml Expect Symbol DBL_PHISH Do Not Expect Symbol DBL_SPAM Do Not Expect Symbol RSPAMD_URIBL Do Not Expect Symbol URIBL_BLACK SURBL Example.org domain - Scan File ${TESTDIR}/messages/url6.eml + Scan File ${RSPAMD_TESTDIR}/messages/url6.eml Expect Symbol URIBL_BLACK Do Not Expect Symbol DBL_SPAM Do Not Expect Symbol RSPAMD_URIBL Do Not Expect Symbol DBL_PHISH SURBL Example.ru domain - Scan File ${TESTDIR}/messages/url7.eml + Scan File ${RSPAMD_TESTDIR}/messages/url7.eml Expect Symbol URIBL_GREY Expect Symbol URIBL_RED Do Not Expect Symbol DBL_SPAM @@ -48,7 +48,7 @@ SURBL Example.ru domain Do Not Expect Symbol URIBL_BLACK SURBL Example.ru ZEN domain - Scan File ${TESTDIR}/messages/url7.eml + Scan File ${RSPAMD_TESTDIR}/messages/url7.eml Expect Symbol URIBL_SBL_CSS Expect Symbol URIBL_XBL Expect Symbol URIBL_PBL @@ -59,7 +59,7 @@ SURBL Example.ru ZEN domain Do Not Expect Symbol URIBL_BLACK SURBL Example.com domain image false - Scan File ${TESTDIR}/messages/urlimage.eml + Scan File ${RSPAMD_TESTDIR}/messages/urlimage.eml Expect Symbol RSPAMD_URIBL_IMAGES Do Not Expect Symbol DBL_SPAM Do Not Expect Symbol RSPAMD_URIBL @@ -67,7 +67,7 @@ SURBL Example.com domain image false Do Not Expect Symbol URIBL_BLACK SURBL @example.com mail html - Scan File ${TESTDIR}/messages/mailadr.eml + Scan File ${RSPAMD_TESTDIR}/messages/mailadr.eml Expect Symbol RSPAMD_URIBL Expect Symbol With Exact Options DBL_SPAM example.com:email Do Not Expect Symbol RSPAMD_URIBL_IMAGES @@ -75,7 +75,7 @@ SURBL @example.com mail html Do Not Expect Symbol URIBL_BLACK SURBL @example.com mail text - Scan File ${TESTDIR}/messages/mailadr2.eml + Scan File ${RSPAMD_TESTDIR}/messages/mailadr2.eml Expect Symbol RSPAMD_URIBL Expect Symbol With Exact Options DBL_SPAM example.com:email Do Not Expect Symbol RSPAMD_URIBL_IMAGES @@ -83,90 +83,80 @@ SURBL @example.com mail text Do Not Expect Symbol URIBL_BLACK SURBL example.com not encoded url in subject - Scan File ${TESTDIR}/messages/urlinsubject.eml + Scan File ${RSPAMD_TESTDIR}/messages/urlinsubject.eml Expect Symbol RSPAMD_URIBL Expect Symbol DBL_SPAM Do Not Expect Symbol DBL_PHISH Do Not Expect Symbol URIBL_BLACK SURBL example.com encoded url in subject - Scan File ${TESTDIR}/messages/urlinsubjectencoded.eml + Scan File ${RSPAMD_TESTDIR}/messages/urlinsubjectencoded.eml Expect Symbol RSPAMD_URIBL Expect Symbol DBL_SPAM Do Not Expect Symbol DBL_PHISH Do Not Expect Symbol URIBL_BLACK WHITELIST - Scan File ${TESTDIR}/messages/whitelist.eml + Scan File ${RSPAMD_TESTDIR}/messages/whitelist.eml Do Not Expect Symbol RSPAMD_URIBL Do Not Expect Symbol DBL_SPAM Do Not Expect Symbol RSPAMD_URIBL_IMAGES EMAILBL full address & domain only - Scan File ${TESTDIR}/messages/emailbltext.eml + Scan File ${RSPAMD_TESTDIR}/messages/emailbltext.eml Expect Symbol RSPAMD_EMAILBL_FULL Expect Symbol RSPAMD_EMAILBL_DOMAINONLY EMAILBL full subdomain address - Scan File ${TESTDIR}/messages/emailbltext2.eml + Scan File ${RSPAMD_TESTDIR}/messages/emailbltext2.eml Expect Symbol RSPAMD_EMAILBL_FULL EMAILBL full subdomain address & domain only - Scan File ${TESTDIR}/messages/emailbltext3.eml + Scan File ${RSPAMD_TESTDIR}/messages/emailbltext3.eml Expect Symbol With Exact Options RSPAMD_EMAILBL_DOMAINONLY baddomain.com:email Expect Symbol With Exact Options RSPAMD_EMAILBL_FULL user.subdomain.baddomain.com:email EMAILBL REPLY TO full address - Scan File ${TESTDIR}/messages/replyto.eml + Scan File ${RSPAMD_TESTDIR}/messages/replyto.eml Expect Symbol RSPAMD_EMAILBL_FULL Do Not Expect Symbol RSPAMD_EMAILBL_DOMAINONLY EMAILBL REPLY TO domain only - Scan File ${TESTDIR}/messages/replyto2.eml + Scan File ${RSPAMD_TESTDIR}/messages/replyto2.eml Expect Symbol RSPAMD_EMAILBL_DOMAINONLY Do Not Expect Symbol RSPAMD_EMAILBL_FULL EMAILBL REPLY TO full subdomain address - Scan File ${TESTDIR}/messages/replytosubdomain.eml + Scan File ${RSPAMD_TESTDIR}/messages/replytosubdomain.eml Expect Symbol RSPAMD_EMAILBL_FULL Do Not Expect Symbol RSPAMD_EMAILBL_DOMAINONLY SURBL IDN domain - Scan File ${TESTDIR}/messages/url8.eml + Scan File ${RSPAMD_TESTDIR}/messages/url8.eml Expect Symbol RSPAMD_URIBL Expect Symbol DBL_SPAM Do Not Expect Symbol DBL_PHISH Do Not Expect Symbol URIBL_BLACK SURBL IDN Punycode domain - Scan File ${TESTDIR}/messages/url9.eml + Scan File ${RSPAMD_TESTDIR}/messages/url9.eml Expect Symbol RSPAMD_URIBL Expect Symbol DBL_SPAM Do Not Expect Symbol DBL_PHISH Do Not Expect Symbol URIBL_BLACK SURBL html entity­ - Scan File ${TESTDIR}/messages/url10.eml + Scan File ${RSPAMD_TESTDIR}/messages/url10.eml Expect Symbol RSPAMD_URIBL SURBL url compose map 1 - Scan File ${TESTDIR}/messages/url11.eml + Scan File ${RSPAMD_TESTDIR}/messages/url11.eml Expect Symbol With Exact Options BAD_SUBDOMAIN clean.dirty.sanchez.com:url SURBL url compose map 2 - Scan File ${TESTDIR}/messages/url12.eml + Scan File ${RSPAMD_TESTDIR}/messages/url12.eml Expect Symbol With Exact Options BAD_SUBDOMAIN 4.very.dirty.sanchez.com:url SURBL url compose map 3 - Scan File ${TESTDIR}/messages/url13.eml + Scan File ${RSPAMD_TESTDIR}/messages/url13.eml Expect Symbol With Exact Options BAD_SUBDOMAIN 41.black.sanchez.com:url - -*** Keywords *** -Surbl Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/surbl.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -Surbl Teardown - Normal Teardown - Terminate All Processes kill=True diff --git a/test/functional/cases/350_magic.robot b/test/functional/cases/350_magic.robot index 941d3c344..6dad5f247 100644 --- a/test/functional/cases/350_magic.robot +++ b/test/functional/cases/350_magic.robot @@ -1,72 +1,71 @@ *** Settings *** -Suite Setup Generic Setup -Suite Teardown Simple Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/lua_script.conf -${LUA_SCRIPT} ${TESTDIR}/lua/magic.lua -${RSPAMD_SCOPE} Suite -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_script.conf +${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/magic.lua +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** Magic detections bundle 1 - Scan File ${TESTDIR}/messages/gargantua.eml - Expect Symbol MAGIC_SYM_ZIP_2 - Expect Symbol MAGIC_SYM_RAR_3 - Expect Symbol MAGIC_SYM_EXE_4 - Expect Symbol MAGIC_SYM_ELF_5 - Expect Symbol MAGIC_SYM_LNK_6 - Expect Symbol MAGIC_SYM_CLASS_7 - Expect Symbol MAGIC_SYM_RTF_8 - Expect Symbol MAGIC_SYM_PDF_9 - Expect Symbol MAGIC_SYM_PS_10 - Expect Symbol MAGIC_SYM_CHM_11 - Expect Symbol MAGIC_SYM_DJVU_12 - Expect Symbol MAGIC_SYM_ARJ_13 - Expect Symbol MAGIC_SYM_CAB_14 - Expect Symbol MAGIC_SYM_ACE_15 - Expect Symbol MAGIC_SYM_TAR_16 - Expect Symbol MAGIC_SYM_BZ2_17 - Expect Symbol MAGIC_SYM_XZ_18 - Expect Symbol MAGIC_SYM_LZ4_19 - Expect Symbol MAGIC_SYM_ZST_20 - Expect Symbol MAGIC_SYM_DMG_21 - Expect Symbol MAGIC_SYM_ISO_22 - Expect Symbol MAGIC_SYM_ZOO_23 - Expect Symbol MAGIC_SYM_EPUB_24 - Expect Symbol MAGIC_SYM_XAR_25 - Expect Symbol MAGIC_SYM_PSD_26 - Expect Symbol MAGIC_SYM_PCX_27 - Expect Symbol MAGIC_SYM_TIFF_28 - Expect Symbol MAGIC_SYM_ICO_29 - Expect Symbol MAGIC_SYM_SWF_30 - Expect Symbol MAGIC_SYM_DOC_31 - Expect Symbol MAGIC_SYM_XLS_32 - Expect Symbol MAGIC_SYM_PPT_33 - Expect Symbol MAGIC_SYM_MSI_34 - Expect Symbol MAGIC_SYM_MSG_35 - Expect Symbol MAGIC_SYM_DOCX_36 - Expect Symbol MAGIC_SYM_XLSX_37 - Expect Symbol MAGIC_SYM_PPTX_38 - Expect Symbol MAGIC_SYM_ODT_39 - Expect Symbol MAGIC_SYM_ODS_40 - Expect Symbol MAGIC_SYM_ODP_41 - Expect Symbol MAGIC_SYM_7Z_42 - Expect Symbol MAGIC_SYM_VSD_43 - Expect Symbol MAGIC_SYM_PNG_44 - Expect Symbol MAGIC_SYM_JPG_45 - Expect Symbol MAGIC_SYM_GIF_46 - Expect Symbol MAGIC_SYM_BMP_47 - Expect Symbol MAGIC_SYM_TXT_48 - Expect Symbol MAGIC_SYM_HTML_49 - Expect Symbol MAGIC_SYM_CSV_50 - Expect Symbol MAGIC_SYM_DWG_51 - Expect Symbol MAGIC_SYM_JAR_52 - Expect Symbol MAGIC_SYM_APK_53 - Expect Symbol MAGIC_SYM_BAT_54 - Expect Symbol MAGIC_SYM_ICS_55 - Expect Symbol MAGIC_SYM_VCF_56 - + Scan File ${RSPAMD_TESTDIR}/messages/gargantua.eml + Expect Symbols MAGIC_SYM_ZIP_2 + ... MAGIC_SYM_RAR_3 + ... MAGIC_SYM_EXE_4 + ... MAGIC_SYM_ELF_5 + ... MAGIC_SYM_LNK_6 + ... MAGIC_SYM_CLASS_7 + ... MAGIC_SYM_RTF_8 + ... MAGIC_SYM_PDF_9 + ... MAGIC_SYM_PS_10 + ... MAGIC_SYM_CHM_11 + ... MAGIC_SYM_DJVU_12 + ... MAGIC_SYM_ARJ_13 + ... MAGIC_SYM_CAB_14 + ... MAGIC_SYM_ACE_15 + ... MAGIC_SYM_TAR_16 + ... MAGIC_SYM_BZ2_17 + ... MAGIC_SYM_XZ_18 + ... MAGIC_SYM_LZ4_19 + ... MAGIC_SYM_ZST_20 + ... MAGIC_SYM_DMG_21 + ... MAGIC_SYM_ISO_22 + ... MAGIC_SYM_ZOO_23 + ... MAGIC_SYM_EPUB_24 + ... MAGIC_SYM_XAR_25 + ... MAGIC_SYM_PSD_26 + ... MAGIC_SYM_PCX_27 + ... MAGIC_SYM_TIFF_28 + ... MAGIC_SYM_ICO_29 + ... MAGIC_SYM_SWF_30 + ... MAGIC_SYM_DOC_31 + ... MAGIC_SYM_XLS_32 + ... MAGIC_SYM_PPT_33 + ... MAGIC_SYM_MSI_34 + ... MAGIC_SYM_MSG_35 + ... MAGIC_SYM_DOCX_36 + ... MAGIC_SYM_XLSX_37 + ... MAGIC_SYM_PPTX_38 + ... MAGIC_SYM_ODT_39 + ... MAGIC_SYM_ODS_40 + ... MAGIC_SYM_ODP_41 + ... MAGIC_SYM_7Z_42 + ... MAGIC_SYM_VSD_43 + ... MAGIC_SYM_PNG_44 + ... MAGIC_SYM_JPG_45 + ... MAGIC_SYM_GIF_46 + ... MAGIC_SYM_BMP_47 + ... MAGIC_SYM_TXT_48 + ... MAGIC_SYM_HTML_49 + ... MAGIC_SYM_CSV_50 + ... MAGIC_SYM_DWG_51 + ... MAGIC_SYM_JAR_52 + ... MAGIC_SYM_APK_53 + ... MAGIC_SYM_BAT_54 + ... MAGIC_SYM_ICS_55 + ... MAGIC_SYM_VCF_56 diff --git a/test/functional/cases/360_force_actions.robot b/test/functional/cases/360_force_actions.robot index b095e78bf..18edf9a96 100644 --- a/test/functional/cases/360_force_actions.robot +++ b/test/functional/cases/360_force_actions.robot @@ -1,15 +1,15 @@ *** Settings *** -Suite Setup Force Actions Setup -Suite Teardown Force Actions Teardown -Library ${TESTDIR}/lib/rspamd.py -Resource ${TESTDIR}/lib/rspamd.robot -Variables ${TESTDIR}/lib/vars.py +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/plugins.conf -${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat -${MESSAGE} ${TESTDIR}/messages/url7.eml -${RSPAMD_SCOPE} Suite +${CONFIG} ${RSPAMD_TESTDIR}/configs/force_actions.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/url7.eml +${RSPAMD_SCOPE} Suite +${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat *** Test Cases *** FORCE ACTIONS from reject to add header @@ -42,13 +42,3 @@ FORCE ACTIONS from add header to reject Expect Action reject Expect Symbol FORCE_ACTION_FORCE_ADD_HEADER_TO_REJECT - -*** Keywords *** -Force Actions Setup - ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/force_actions.conf - Set Suite Variable ${PLUGIN_CONFIG} - Generic Setup PLUGIN_CONFIG - -Force Actions Teardown - Normal Teardown - Terminate All Processes kill=True diff --git a/test/functional/cases/__init__.robot b/test/functional/cases/__init__.robot index 231387974..51192d702 100644 --- a/test/functional/cases/__init__.robot +++ b/test/functional/cases/__init__.robot @@ -5,15 +5,15 @@ Variables ../lib/vars.py *** Keywords *** Export Global Variables - ${TESTDIR} = Get Test Directory + ${RSPAMD_TESTDIR} = Get Test Directory ${TOPDIR} = Get Top Dir ${RSPAMADM} = Get Rspamadm ${RSPAMC} = Get Rspamc ${RSPAMD} = Get Rspamd - ${INSTALLROOT} = Get Install Root - Set Global Variable ${INSTALLROOT} + ${RSPAMD_INSTALLROOT} = Get Install Root + Set Global Variable ${RSPAMD_INSTALLROOT} Set Global Variable ${RSPAMADM} Set Global Variable ${RSPAMC} Set Global Variable ${RSPAMD} - Set Global Variable ${TESTDIR} + Set Global Variable ${RSPAMD_TESTDIR} Set Global Variable ${TOPDIR} diff --git a/test/functional/configs/antivirus.conf b/test/functional/configs/antivirus.conf index d38c69a42..8b971a588 100644 --- a/test/functional/configs/antivirus.conf +++ b/test/functional/configs/antivirus.conf @@ -1,18 +1,20 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; } antivirus { clam { attachments_only = false; symbol = "CLAM_VIRUS"; type = "clamav"; - servers = "127.0.0.1:${PORT_CLAM}"; + servers = "127.0.0.1:{= env.PORT_CLAM =}"; } fprot { attachments_only = false; symbol = "FPROT_VIRUS"; type = "fprot"; - servers = "127.0.0.1:${PORT_FPROT}"; + servers = "127.0.0.1:{= env.PORT_FPROT =}"; patterns { FPROT_EICAR = "^EICAR_Test_File$"; } @@ -22,7 +24,7 @@ antivirus { attachments_only = false; symbol = "FPROT2_VIRUS_DUPLICATE_DEFAULT"; type = "fprot"; - servers = "127.0.0.1:${PORT_FPROT2_DUPLICATE}"; + servers = "127.0.0.1:{= env.PORT_FPROT2_DUPLICATE =}"; patterns = [ {FPROT2_VIRUS_DUPLICATE_PATTERN = "^E"}, {FPROT2_VIRUS_DUPLICATE_NOPE1 = "^EI", @@ -36,6 +38,6 @@ antivirus { attachments_only = false; symbol = "AVAST_VIRUS"; type = "avast"; - servers = "127.0.0.1:${PORT_AVAST}"; + servers = "127.0.0.1:{= env.PORT_AVAST =}"; } } diff --git a/test/functional/configs/arc.conf b/test/functional/configs/arc.conf index 5f8797fe8..8a8a525c7 100644 --- a/test/functional/configs/arc.conf +++ b/test/functional/configs/arc.conf @@ -1 +1,3 @@ -arc { }
\ No newline at end of file +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + +arc { } diff --git a/test/functional/configs/arc_signing/redis.conf b/test/functional/configs/arc_signing/redis.conf index b2a9aa134..0d049c372 100644 --- a/test/functional/configs/arc_signing/redis.conf +++ b/test/functional/configs/arc_signing/redis.conf @@ -1,8 +1,10 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + arc { use_redis = true; key_prefix = "TEST_DKIM_KEYS"; selector_prefix = "TEST_DKIM_SELECTORS"; } redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; } diff --git a/test/functional/configs/arc_signing/simple.conf b/test/functional/configs/arc_signing/simple.conf index 5807d7346..f559e61bd 100644 --- a/test/functional/configs/arc_signing/simple.conf +++ b/test/functional/configs/arc_signing/simple.conf @@ -1,5 +1,7 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + arc { - path = "${TESTDIR}/configs/dkim.key"; + path = "{= env.TESTDIR =}/configs/dkim.key"; check_pubkey = true; allow_pubkey_mismatch = false; selector = "dkim"; diff --git a/test/functional/configs/clickhouse-config.xml b/test/functional/configs/clickhouse-config.xml index 30f556f0c..3b5c914cd 100644 --- a/test/functional/configs/clickhouse-config.xml +++ b/test/functional/configs/clickhouse-config.xml @@ -3,8 +3,8 @@ <logger> <!-- Possible levels: https://github.com/pocoproject/poco/blob/develop/Foundation/include/Poco/Logger.h#L105 --> <level>debug</level> - <log>${TMPDIR}/clickhouse/clickhouse-server.log</log> - <errorlog>${TMPDIR}/clickhouse/clickhouse-server.err.log</errorlog> + <log>${RSPAMD_TMPDIR}/clickhouse/clickhouse-server.log</log> + <errorlog>${RSPAMD_TMPDIR}/clickhouse/clickhouse-server.err.log</errorlog> <size>1000M</size> <count>10</count> <!-- <console>1</console> --> <!-- Default behavior is autodetection (log to console if not daemon mode and is tty) --> @@ -14,7 +14,7 @@ <http_port>${CLICKHOUSE_PORT}</http_port> <!-- Path to configuration file with users, access rights, profiles of settings, quotas. --> - <users_config>${TMPDIR}/users.xml</users_config> + <users_config>${RSPAMD_TMPDIR}/users.xml</users_config> <!-- <listen_reuse_port>0</listen_reuse_port> --> @@ -37,7 +37,7 @@ <mark_cache_size>5368709120</mark_cache_size> <!-- Path to data directory, with trailing slash. --> - <path>${TMPDIR}/clickhouse/</path> + <path>${RSPAMD_TMPDIR}/clickhouse/</path> <!-- Default profile of settings. --> <default_profile>default</default_profile> diff --git a/test/functional/configs/clickhouse.conf b/test/functional/configs/clickhouse.conf index 08a3614a5..f92f2e759 100644 --- a/test/functional/configs/clickhouse.conf +++ b/test/functional/configs/clickhouse.conf @@ -1,6 +1,6 @@ options = { filters = ["spf", "dkim", "regexp"] - pidfile = "${TMPDIR}/rspamd.pid" + pidfile = "${RSPAMD_TMPDIR}/rspamd.pid" lua_path = "${INSTALLROOT}/share/rspamd/lib/?.lua" dns { nameserver = ["8.8.8.8", "8.8.4.4"]; @@ -34,7 +34,7 @@ clickhouse { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "${RSPAMD_TMPDIR}/rspamd.log" } metric = { name = "default", @@ -45,19 +45,19 @@ metric = { } worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_NORMAL} count = 1 task_timeout = 60s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER} count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "${RSPAMD_TMPDIR}/stats.ucl" } -lua = "${TESTDIR}/lua/test_coverage.lua"; +lua = "${RSPAMD_TESTDIR}/lua/test_coverage.lua"; modules { - path = "${TESTDIR}/../../src/plugins/lua/" + path = "${RSPAMD_TESTDIR}/../../src/plugins/lua/" } lua = "${INSTALLROOT}/share/rspamd/rules/rspamd.lua" diff --git a/test/functional/configs/composites.conf b/test/functional/configs/composites.conf index 71e453def..28b645e60 100644 --- a/test/functional/configs/composites.conf +++ b/test/functional/configs/composites.conf @@ -1,27 +1,27 @@ options = { - pidfile = "${TMPDIR}/rspamd.pid" + pidfile = "{= env.TMPDIR =}/rspamd.pid" } logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" } worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 task_timeout = 60s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } -lua = "${TESTDIR}/lua/test_coverage.lua"; -lua = ${LUA_SCRIPT}; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; +lua = {= env.LUA_SCRIPT =}; composites { EXPRESSIONS { @@ -77,7 +77,7 @@ composites { score = 6.0; } SYMOPTS3 { - expression = 'OPTS[sym2,/FoO\\//i]'; + expression = 'OPTS[sym2,/FoO\//i]'; score = 6.0; } SYMOPTS4 { diff --git a/test/functional/configs/dkim.conf b/test/functional/configs/dkim.conf index cc2f6f250..50712d17b 100644 --- a/test/functional/configs/dkim.conf +++ b/test/functional/configs/dkim.conf @@ -1,35 +1,17 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + options = { filters = ["dkim"] - pidfile = "${TMPDIR}/rspamd.pid" + pidfile = "{= env.TMPDIR =}/rspamd.pid" dns { retransmits = 10; timeout = 2s; - fake_records = [{ # ed25519 - name = "test._domainkey.example.com"; - type = txt; - replies = ["k=ed25519; p=yi50DjK5O9pqbFpNHklsv9lqaS0ArSYu02qp1S0DW1Y="]; - }, - { - name = "brisbane._domainkey.football.example.com"; - type = txt; - replies = ["v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo="]; - }, - { - name = "test._domainkey.football.example.com"; - type = txt; - replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkHlOQoBTzWRiGs5V6NpP3idY6Wk08a5qhdR6wy5bdOKb2jLQiY/J16JYi0Qvx/byYzCNb3W91y3FutACDfzwQ/BC/e/8uBsCR+yz1Lxj+PL6lHvqMKrM3rG4hstT5QjvHO9PzoxZyVYLzBfO2EeC3Ip3G+2kryOTIKT+l/K4w3QIDAQAB"], - }, - { - name = "dkim._domainkey.cacophony.za.org", - type = "txt"; - replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXtxBE5IiNRMcq2/lc2zErfdCvDFyQNBnMjbOjBQrPST2k4fdGbtpe5Iu5uS01Met+dAEf94XL8I0hwmYw+n70PP834zfJGi2egwGqrakpaWsCDPvIJZLkxJCJKQRA/zrQ622uEXdvYixVbsEGVw7U4wAGSmT5rU2eU1y63AlOlQIDAQAB"]; - }]; } } logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" } metric = { name = "default", @@ -41,21 +23,21 @@ metric = { worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 keypair { - pubkey = "${KEY_PUB1}"; - privkey = "${KEY_PVT1}"; + pubkey = "{= env.KEY_PUB1 =}"; + privkey = "{= env.KEY_PVT1 =}"; } task_timeout = 60s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } dkim { @@ -65,7 +47,7 @@ return function(task) local dodkim = task:get_request_header('dodkim') if not dodkim then return end return { - key = "${TESTDIR}/configs/dkim.key", + key = "{= env.TESTDIR =}/configs/dkim.key", domain = "cacophony.za.org", selector = "dkim" } @@ -79,6 +61,6 @@ EOD; skip_multi = false; } modules { - path = "${TESTDIR}/../../src/plugins/lua/" + path = "{= env.TESTDIR =}/../../src/plugins/lua/" } -lua = "${TESTDIR}/lua/test_coverage.lua"; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; diff --git a/test/functional/configs/dkim_signing/eddsa.conf b/test/functional/configs/dkim_signing/eddsa.conf index 1a93c9e0b..a8cdfaa78 100644 --- a/test/functional/configs/dkim_signing/eddsa.conf +++ b/test/functional/configs/dkim_signing/eddsa.conf @@ -1,5 +1,7 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + dkim_signing { - path = "${TESTDIR}/configs/dkim-eddsa.key"; + path = "{= env.TESTDIR =}/configs/dkim-eddsa.key"; selector = "eddsa"; check_pubkey = true; allow_pubkey_mismatch = false; diff --git a/test/functional/configs/dkim_signing/invalidate.conf b/test/functional/configs/dkim_signing/invalidate.conf index 48b1cec16..b7913cd0a 100644 --- a/test/functional/configs/dkim_signing/invalidate.conf +++ b/test/functional/configs/dkim_signing/invalidate.conf @@ -1,5 +1,7 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + dkim_signing { - path = "${KEY_DIR}/dkim-eddsa.key"; + path = "{= env.KEY_DIR =}/dkim-eddsa.key"; selector = "eddsa"; check_pubkey = true; allow_pubkey_mismatch = false; diff --git a/test/functional/configs/dkim_signing/milter.conf b/test/functional/configs/dkim_signing/milter.conf index 263ed0b4e..a373e16b0 100644 --- a/test/functional/configs/dkim_signing/milter.conf +++ b/test/functional/configs/dkim_signing/milter.conf @@ -1,8 +1,8 @@ options = { filters = ["dkim"] - url_tld = "${URL_TLD}" - pidfile = "${TMPDIR}/rspamd.pid" - lua_path = "${INSTALLROOT}/share/rspamd/lib/?.lua" + url_tld = "{= env.URL_TLD =}" + pidfile = "{= env.TMPDIR =}/rspamd.pid" + lua_path = "{= env.INSTALLROOT =}/share/rspamd/lib/?.lua" dns { nameserver = ["8.8.8.8", "8.8.4.4"]; retransmits = 10; @@ -12,7 +12,7 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" } metric = { name = "default", @@ -23,16 +23,16 @@ metric = { } worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 task_timeout = 60s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } worker { type = "rspamd_proxy"; @@ -40,28 +40,28 @@ worker { timeout = 120; upstream { local { - hosts = "${LOCAL_ADDR}:${PORT_NORMAL}"; + hosts = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}"; default = true; } } - bind_socket = "${LOCAL_ADDR}:${PORT_PROXY}"; + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_PROXY =}"; milter = true; } dkim_signing { domain { cacophony.za.org { selectors = { - path: "${TESTDIR}/configs/dkim.key"; + path: "{= env.TESTDIR =}/configs/dkim.key"; selector: "dkim"; } selectors = { - path: "${TESTDIR}/configs/dkim-eddsa.key"; + path: "{= env.TESTDIR =}/configs/dkim-eddsa.key"; selector: "eddsa"; } } invalid.za.org { selectors = [ - { path: "${TESTDIR}/configs/dkim-eddsa.key"; + { path: "{= env.TESTDIR =}/configs/dkim-eddsa.key"; selector: "eddsa"; } ] } @@ -69,8 +69,8 @@ dkim_signing { allow_pubkey_mismatch: true; } modules { - path = "${TESTDIR}/../../src/plugins/lua/dkim_signing.lua" + path = "{= env.TESTDIR =}/../../src/plugins/lua/dkim_signing.lua" } -lua = "${TESTDIR}/lua/test_coverage.lua"; -lua = "${INSTALLROOT}/share/rspamd/rules/rspamd.lua" -lua = "${TESTDIR}/lua/params.lua" +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; +lua = "{= env.INSTALLROOT =}/share/rspamd/rules/rspamd.lua" +lua = "{= env.TESTDIR =}/lua/params.lua" diff --git a/test/functional/configs/dkim_signing/multiple.conf b/test/functional/configs/dkim_signing/multiple.conf index 072842183..029c2b5e9 100644 --- a/test/functional/configs/dkim_signing/multiple.conf +++ b/test/functional/configs/dkim_signing/multiple.conf @@ -1,12 +1,14 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + dkim_signing { domain { cacophony.za.org { selectors = { - path: "${TESTDIR}/configs/dkim.key"; + path: "{= env.TESTDIR =}/configs/dkim.key"; selector: "dkim"; } selectors = { - path: "${TESTDIR}/configs/dkim-eddsa.key"; + path: "{= env.TESTDIR =}/configs/dkim-eddsa.key"; selector: "eddsa"; } } diff --git a/test/functional/configs/dkim_signing/redis.conf b/test/functional/configs/dkim_signing/redis.conf index 903a13cf4..02dc2eacd 100644 --- a/test/functional/configs/dkim_signing/redis.conf +++ b/test/functional/configs/dkim_signing/redis.conf @@ -1,8 +1,10 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + dkim_signing { use_redis = true; key_prefix = "TEST_DKIM_KEYS"; selector_prefix = "TEST_DKIM_SELECTORS"; } redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; } diff --git a/test/functional/configs/dkim_signing/sign_maps.conf b/test/functional/configs/dkim_signing/sign_maps.conf index 9e63b7fc4..6993f1f21 100644 --- a/test/functional/configs/dkim_signing/sign_maps.conf +++ b/test/functional/configs/dkim_signing/sign_maps.conf @@ -1,3 +1,5 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + dkim_signing { signing_table = [ "*@cacophony.za.org cacophony.za.org", @@ -6,4 +8,4 @@ dkim_signing { key_table = [ "cacophony.za.org %:eddsa:m5kGxtckRfsNe5EuYTe7bvkDjSh7LXaX3aXyIMPGLR0=", ]; -}
\ No newline at end of file +} diff --git a/test/functional/configs/dkim_signing/simple.conf b/test/functional/configs/dkim_signing/simple.conf index 14b8d5ec6..9b812ec7e 100644 --- a/test/functional/configs/dkim_signing/simple.conf +++ b/test/functional/configs/dkim_signing/simple.conf @@ -1,5 +1,7 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + dkim_signing { - path = "${TESTDIR}/configs/dkim.key"; + path = "{= env.TESTDIR =}/configs/dkim.key"; check_pubkey = true; allow_pubkey_mismatch = false; use_http_headers = true; diff --git a/test/functional/configs/dmarc.conf b/test/functional/configs/dmarc.conf index b6164f9d2..130e5612c 100644 --- a/test/functional/configs/dmarc.conf +++ b/test/functional/configs/dmarc.conf @@ -1,6 +1,8 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + dmarc { } spf { external_relay = [ - "${TESTDIR}/configs/maps/external_relay_ip.list", + "{= env.TESTDIR =}/configs/maps/external_relay_ip.list", ]; -}
\ No newline at end of file +} diff --git a/test/functional/configs/empty.conf b/test/functional/configs/empty.conf new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/functional/configs/empty.conf diff --git a/test/functional/configs/force_actions.conf b/test/functional/configs/force_actions.conf index 61732c4ac..aed3d05fa 100644 --- a/test/functional/configs/force_actions.conf +++ b/test/functional/configs/force_actions.conf @@ -1,3 +1,5 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + force_actions { rules { FORCE_REJECT_TO_ADD_HEADER { @@ -83,4 +85,4 @@ settings { } } } -}
\ No newline at end of file +} diff --git a/test/functional/configs/fuzzy-encryption-key.conf b/test/functional/configs/fuzzy-encryption-key.conf new file mode 100644 index 000000000..522081b08 --- /dev/null +++ b/test/functional/configs/fuzzy-encryption-key.conf @@ -0,0 +1,2 @@ +# Setting this to null does not work out so it's hidden in an include +encryption_key = {= env.FUZZY_ENCRYPTION_KEY =}; diff --git a/test/functional/configs/fuzzy.conf b/test/functional/configs/fuzzy.conf index bc4e72e7b..8af1cfa3f 100644 --- a/test/functional/configs/fuzzy.conf +++ b/test/functional/configs/fuzzy.conf @@ -1,12 +1,12 @@ redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; } -lua = "${TESTDIR}/lua/test_coverage.lua"; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; options = { filters = "fuzzy_check"; - pidfile = "${TMPDIR}/rspamd.pid"; - control_socket = "${TMPDIR}/rspamd.sock mode=0600"; - url_tld = "${TESTDIR}/../lua/unit/test_tld.dat"; + pidfile = "{= env.TMPDIR =}/rspamd.pid"; + control_socket = "{= env.TMPDIR =}/rspamd.sock mode=0600"; + url_tld = "{= env.TESTDIR =}/../lua/unit/test_tld.dat"; dns { retransmits = 10; timeout = 2s; @@ -15,7 +15,7 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" } metric = { name = "default", @@ -25,36 +25,41 @@ metric = { unknown_weight = 1 symbol { weight = 10.0; - name = "${FLAG1_SYMBOL}"; + name = "{= env.FLAG1_SYMBOL =}"; } symbol { weight = -1.0; - name = "${FLAG2_SYMBOL}"; + name = "{= env.FLAG2_SYMBOL =}"; } } worker { type = normal - bind_socket = "${LOCAL_ADDR}:${PORT_NORMAL}"; + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}"; count = 1 task_timeout = 60s; } worker { type = controller - bind_socket = "${LOCAL_ADDR}:${PORT_CONTROLLER}"; + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}"; count = 1 - secure_ip = ["${LOCAL_ADDR}"]; - stats_path = "${TMPDIR}/stats.ucl"; + secure_ip = ["{= env.LOCAL_ADDR =}"]; + stats_path = "{= env.TMPDIR =}/stats.ucl"; } worker { count = 1; - bind_socket = "${LOCAL_ADDR}:${PORT_FUZZY}"; + backend = "{= env.FUZZY_BACKEND =}"; + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_FUZZY =}"; type = "fuzzy"; - hashfile = "${TMPDIR}/fuzzy.db"; - allow_update = ["${LOCAL_ADDR}"]; -${SETTINGS_FUZZY_WORKER} + hashfile = "{= env.TMPDIR =}/fuzzy.db"; + allow_update = ["{= env.LOCAL_ADDR =}"]; + encrypted_only = {= env.FUZZY_ENCRYPTED_ONLY =}; + keypair { + privkey = "{= env.KEY_PVT1 =}"; + pubkey = "{= env.KEY_PUB1 =}"; + } } fuzzy_check { @@ -65,23 +70,25 @@ fuzzy_check { rule { min_bytes = 0; min_length = 0; - algorithm = "${ALGORITHM}"; - servers = "${LOCAL_ADDR}:${PORT_FUZZY}"; + algorithm = "{= env.FUZZY_ALGORITHM =}"; + servers = "{= env.LOCAL_ADDR =}:{= env.PORT_FUZZY =}"; symbol = "R_TEST_FUZZY"; max_score = 10.0; mime_types = ["application/*"]; read_only = false; skip_unknown = true; - skip_hashes = "${TMPDIR}/skip_hash.map"; -${SETTINGS_FUZZY_CHECK} + skip_hashes = "{= env.TMPDIR =}/skip_hash.map"; + fuzzy_key = {= env.FUZZY_KEY =}; + fuzzy_shingles_key = {= env.FUZZY_SHINGLES_KEY =}; +.include "{= env.FUZZY_INCLUDE =}"; fuzzy_map = { - ${FLAG1_SYMBOL} { + R_TEST_FUZZY_DENIED { max_score = 10.0; - flag = ${FLAG1_NUMBER}; + flag = {= env.FLAG1_NUMBER =}; } - ${FLAG2_SYMBOL} { + R_TEST_FUZZY_WHITE { max_score = 1.0; - flag = ${FLAG2_NUMBER}; + flag = {= env.FLAG2_NUMBER =}; } } } diff --git a/test/functional/configs/fuzzy_master_worker.conf b/test/functional/configs/fuzzy_master_worker.conf deleted file mode 100644 index 0424afc86..000000000 --- a/test/functional/configs/fuzzy_master_worker.conf +++ /dev/null @@ -1,12 +0,0 @@ -sync_keypair { - pubkey = "kmtnjffjzq9bq8qe14ii4gb4e1ihuq84ubfibe79ba85ob5nr3my"; - privkey = "ea6etw8a47e66ypc38mmdnrwskx7nj86gqydwo7jrmfsxeryny1y"; - id = "6jxoadfy8gr6dq1nyafoa5ym3391sioz3fbbq5qug7g9dchmgjr4w4kxjzqkkc9rzd7eftngyzwau9ooqe9g96bxiwq6c3xo8965gud"; - encoding = "base32"; - algorithm = "curve25519"; -} -slave { - name = "slave1"; - hosts = "${LOCAL_ADDR}:${PORT_FUZZY_SLAVE}"; - key = "caen11q4eczdqgsb8u55zmmoh4z5qxd61y1rph7pz1fcubmfccdy"; -} diff --git a/test/functional/configs/fuzzy_slave_worker.conf b/test/functional/configs/fuzzy_slave_worker.conf deleted file mode 100644 index 44ed1de71..000000000 --- a/test/functional/configs/fuzzy_slave_worker.conf +++ /dev/null @@ -1,11 +0,0 @@ -sync_keypair { - pubkey = "caen11q4eczdqgsb8u55zmmoh4z5qxd61y1rph7pz1fcubmfccdy"; - privkey = "oi4k9g9prsqmk19xio7itaobmbz7yonktren1j5qwni1t88mwfty"; - id = "qdwzxmoxpno4ge68ba1ai35n65q7mrqdp8dpp33h8haxy61omt881mep4944w1n6izuk64ktypqymrq55zkx3qob1ayfz9hxjtxbmxb"; - encoding = "base32"; - algorithm = "curve25519"; - type = "kex"; -} - -masters = "${LOCAL_ADDR}"; -master_key = "kmtnjffjzq9bq8qe14ii4gb4e1ihuq84ubfibe79ba85ob5nr3my"; diff --git a/test/functional/configs/greylist.conf b/test/functional/configs/greylist.conf index 5e12accf9..d47500ce8 100644 --- a/test/functional/configs/greylist.conf +++ b/test/functional/configs/greylist.conf @@ -1,5 +1,7 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; } greylist { check_local = true; diff --git a/test/functional/configs/lua_script.conf b/test/functional/configs/lua_script.conf index 2bde672fe..8798bff37 100644 --- a/test/functional/configs/lua_script.conf +++ b/test/functional/configs/lua_script.conf @@ -1,25 +1,25 @@ options = { - pidfile = "${TMPDIR}/rspamd.pid" + pidfile = "{= env.TMPDIR =}/rspamd.pid" } logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" } worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 task_timeout = 60s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } -lua = "${TESTDIR}/lua/test_coverage.lua"; -lua = ${LUA_SCRIPT}; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; +lua = "{= env.LUA_SCRIPT =}"; diff --git a/test/functional/configs/lua_test.conf b/test/functional/configs/lua_test.conf index ebdcff860..1d36536dd 100644 --- a/test/functional/configs/lua_test.conf +++ b/test/functional/configs/lua_test.conf @@ -1,8 +1,8 @@ options = { filters = ["spf", "dkim", "regexp"] - url_tld = "${URL_TLD}" - pidfile = "${TMPDIR}/rspamd.pid" - map_watch_interval = ${MAP_WATCH_INTERVAL}; + url_tld = "{= env.URL_TLD =}" + pidfile = "{= env.TMPDIR =}/rspamd.pid" + map_watch_interval = {= env.MAP_WATCH_INTERVAL =}; dns { retransmits = 10; timeout = 2s; @@ -24,7 +24,7 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" log_usec = true; } metric = { @@ -37,16 +37,16 @@ metric = { worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 task_timeout = 10s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } -lua = "${TESTDIR}/lua/test_coverage.lua"; -lua = ${LUA_SCRIPT}; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; +lua = "{= env.LUA_SCRIPT =}"; diff --git a/test/functional/configs/mid.conf b/test/functional/configs/mid.conf index 49f5cb568..ce024299a 100644 --- a/test/functional/configs/mid.conf +++ b/test/functional/configs/mid.conf @@ -1,9 +1,11 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + mid = { source = { url = [ "https://maps.rspamd.com/rspamd/mid.inc.zst", - "fallback+file://${TESTDIR}/../../../conf/mid.inc", - "file://${TESTDIR}/configs/maps/mid.list" + "fallback+file://{= env.TESTDIR =}/../../../conf/mid.inc", + "file://{= env.TESTDIR =}/configs/maps/mid.list" ]; } } diff --git a/test/functional/configs/milter.conf b/test/functional/configs/milter.conf index e09ee48d8..aaf148c12 100644 --- a/test/functional/configs/milter.conf +++ b/test/functional/configs/milter.conf @@ -1,8 +1,8 @@ options = { filters = ["spf", "dkim", "regexp"] - url_tld = "${URL_TLD}" - pidfile = "${TMPDIR}/rspamd.pid" - lua_path = "${INSTALLROOT}/share/rspamd/lib/?.lua"; + url_tld = "{= env.URL_TLD =}" + pidfile = "{= env.TMPDIR =}/rspamd.pid" + lua_path = "{= env.INSTALLROOT =}/share/rspamd/lib/?.lua"; enable_test_patterns = true; dns { nameserver = ["8.8.8.8", "8.8.4.4"]; @@ -13,7 +13,7 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" } metric = { name = "default", @@ -24,16 +24,16 @@ metric = { } worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 task_timeout = 60s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } worker { type = "rspamd_proxy"; @@ -41,19 +41,19 @@ worker { timeout = 120; upstream { local { - hosts = "${LOCAL_ADDR}:${PORT_NORMAL}"; + hosts = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}"; default = true; } } - bind_socket = "${LOCAL_ADDR}:${PORT_PROXY}"; + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_PROXY =}"; milter = true; } modules { - path = "${TESTDIR}/../../src/plugins/lua/" + path = "{= env.TESTDIR =}/../../src/plugins/lua/" } -lua = "${TESTDIR}/lua/test_coverage.lua"; -lua = "${INSTALLROOT}/share/rspamd/rules/rspamd.lua" -lua = "${TESTDIR}/lua/params.lua" +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; +lua = "{= env.INSTALLROOT =}/share/rspamd/rules/rspamd.lua" +lua = "{= env.TESTDIR =}/lua/params.lua" milter_headers { extended_spam_headers = true; skip_local = false; diff --git a/test/functional/configs/mime_types.conf b/test/functional/configs/mime_types.conf index e28feba98..82bd4187c 100644 --- a/test/functional/configs/mime_types.conf +++ b/test/functional/configs/mime_types.conf @@ -1,7 +1,9 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + mime_types { file = [ "https://maps.rspamd.com/rspamd/mime_types.inc.zst", - "fallback+file://${TESTDIR}/../../../conf/mime_types.inc" + "fallback+file://{= env.TESTDIR =}/../../../conf/mime_types.inc" ]; extension_map { html = "text/html"; @@ -15,5 +17,5 @@ mime_types { "application/pdf", ] } - filename_whitelist = "${TESTDIR}/configs/maps/mime_types.wl"; + filename_whitelist = "{= env.TESTDIR =}/configs/maps/mime_types.wl"; } diff --git a/test/functional/configs/multimap.conf b/test/functional/configs/multimap.conf index 9158f657c..c59c1ac57 100644 --- a/test/functional/configs/multimap.conf +++ b/test/functional/configs/multimap.conf @@ -1,8 +1,10 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + asn { } spf {} redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; expand_keys = true; } multimap { @@ -12,76 +14,76 @@ multimap { } IP_MAP { type = "ip"; - map = "${TESTDIR}/configs/maps/ip.list"; + map = "{= env.TESTDIR =}/configs/maps/ip.list"; } FROM_MAP { type = "from"; filter = "email:domain"; - map = "${TESTDIR}/configs/maps/domains.list"; + map = "{= env.TESTDIR =}/configs/maps/domains.list"; } FREEMAIL_CC { type = "header"; header = "Cc"; filter = "email:domain"; - map = "${TESTDIR}/configs/maps/domains.list.2"; + map = "{= env.TESTDIR =}/configs/maps/domains.list.2"; score = 1.0; } REGEXP_MAP { type = "from"; filter = "email:addr"; regexp = true; - map = "${TESTDIR}/configs/maps/regexp.list"; + map = "{= env.TESTDIR =}/configs/maps/regexp.list"; } DEPS_MAP { type = "from"; filter = "email:addr"; regexp = true; - map = "${TESTDIR}/configs/maps/regexp.list"; + map = "{= env.TESTDIR =}/configs/maps/regexp.list"; require_symbols = "(R_SPF_ALLOW|R_SPF_DNSFAIL) & REGEXP_MAP & !FROM_MAP"; } RCPT_DOMAIN { type = "rcpt"; filter = "email:domain"; - map = "${TESTDIR}/configs/maps/domains.list"; + map = "{= env.TESTDIR =}/configs/maps/domains.list"; } RCPT_USER { type = "rcpt"; filter = "email:user"; - map = "${TESTDIR}/configs/maps/users.list"; + map = "{= env.TESTDIR =}/configs/maps/users.list"; } RCPT_MAP { type = "rcpt"; filter = "email:addr"; symbols = ["SYM1"]; - map = "${TESTDIR}/configs/maps/multiple.list"; + map = "{= env.TESTDIR =}/configs/maps/multiple.list"; score = 1.0; } RCPT_MAP_NOMULTISYM { type = "rcpt"; filter = "email:addr"; disable_multisymbol = true; - map = "${TESTDIR}/configs/maps/multiple.list"; + map = "{= env.TESTDIR =}/configs/maps/multiple.list"; score = 1.0; } HEADER_MAP { type = "header"; header = "To"; filter = "email:name"; - map = "${TESTDIR}/configs/maps/utf.list"; + map = "{= env.TESTDIR =}/configs/maps/utf.list"; regexp = true; } HOSTNAME_MAP { type = "hostname"; - map = "${TESTDIR}/configs/maps/domains.list"; + map = "{= env.TESTDIR =}/configs/maps/domains.list"; } HOSTNAME_TOP_MAP { type = "hostname"; filter = "top"; - map = "${TESTDIR}/configs/maps/top.list"; + map = "{= env.TESTDIR =}/configs/maps/top.list"; } CDB_HOSTNAME { type = "hostname"; - map = "cdb://${TESTDIR}/configs/maps/domains.cdb"; + map = "cdb://{= env.TESTDIR =}/configs/maps/domains.cdb"; } REDIS_HOSTNAME { type = "hostname"; @@ -89,7 +91,7 @@ multimap { } REDIS_HOSTNAME_EXPANSION { type = "hostname"; - map = "redis://\${ip}.\${principal_recipient_domain}"; + map = "redis://${ip}.${principal_recipient_domain}"; } REDIS_IPADDR { type = "ip"; @@ -151,12 +153,12 @@ multimap { RCVD_TEST_01 { type = "received"; max_pos = 1; - map = "${TESTDIR}/configs/maps/rcvd.list"; + map = "{= env.TESTDIR =}/configs/maps/rcvd.list"; } RCVD_TEST_02 { type = "received"; min_pos = -1; - map = "${TESTDIR}/configs/maps/rcvd.list"; + map = "{= env.TESTDIR =}/configs/maps/rcvd.list"; } RCVD_TEST_REDIS_01 { type = "received"; @@ -164,13 +166,13 @@ multimap { } RCVD_AUTHED_ONE { type = "received"; - map = "${TESTDIR}/configs/maps/rcvd2.list"; + map = "{= env.TESTDIR =}/configs/maps/rcvd2.list"; flags = ["authenticated"]; nflags = ["ssl"]; } RCVD_AUTHED_TWO { type = "received"; - map = "${TESTDIR}/configs/maps/rcvd2.list"; + map = "{= env.TESTDIR =}/configs/maps/rcvd2.list"; flags = ["authenticated", "ssl"]; } COMBINED_MAP_AND { @@ -178,11 +180,11 @@ multimap { rules { ip = { type = "radix"; - map = "${TESTDIR}/configs/maps/ip.list"; + map = "{= env.TESTDIR =}/configs/maps/ip.list"; selector = "ip"; } from { - map = "${TESTDIR}/configs/maps/domains.list"; + map = "{= env.TESTDIR =}/configs/maps/domains.list"; selector = "from:domain"; } } @@ -195,11 +197,11 @@ multimap { rules { ip = { type = "radix"; - map = "${TESTDIR}/configs/maps/ip.list"; + map = "{= env.TESTDIR =}/configs/maps/ip.list"; selector = "ip"; } from { - map = "${TESTDIR}/configs/maps/domains.list"; + map = "{= env.TESTDIR =}/configs/maps/domains.list"; selector = "from:domain"; } } diff --git a/test/functional/configs/neural.conf b/test/functional/configs/neural.conf index 871a549fe..7a7f36ffc 100644 --- a/test/functional/configs/neural.conf +++ b/test/functional/configs/neural.conf @@ -1,7 +1,7 @@ options = { - url_tld = "${URL_TLD}" - pidfile = "${TMPDIR}/rspamd.pid" - lua_path = "${INSTALLROOT}/share/rspamd/lib/?.lua" + url_tld = "{= env.URL_TLD =}" + pidfile = "{= env.TMPDIR =}/rspamd.pid" + lua_path = "{= env.INSTALLROOT =}/share/rspamd/lib/?.lua" filters = []; explicit_modules = ["settings"]; } @@ -9,7 +9,7 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" log_usec = true; } metric = { @@ -22,23 +22,23 @@ metric = { } worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 task_timeout = 10s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } modules { - path = "${TESTDIR}/../../src/plugins/lua/" + path = "{= env.TESTDIR =}/../../src/plugins/lua/" } -lua = "${TESTDIR}/lua/test_coverage.lua"; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; neural { rules { @@ -76,8 +76,8 @@ neural { } redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; expand_keys = true; } -lua = "${TESTDIR}/lua/neural.lua";
\ No newline at end of file +lua = "{= env.TESTDIR =}/lua/neural.lua"; diff --git a/test/functional/configs/neural_noauto.conf b/test/functional/configs/neural_noauto.conf index 55f0a4283..e228da850 100644 --- a/test/functional/configs/neural_noauto.conf +++ b/test/functional/configs/neural_noauto.conf @@ -1,7 +1,7 @@ options = { - url_tld = "${URL_TLD}" - pidfile = "${TMPDIR}/rspamd.pid" - lua_path = "${INSTALLROOT}/share/rspamd/lib/?.lua" + url_tld = "{= env.URL_TLD =}" + pidfile = "{= env.TMPDIR =}/rspamd.pid" + lua_path = "{= env.INSTALLROOT =}/share/rspamd/lib/?.lua" filters = []; explicit_modules = ["settings"]; } @@ -9,7 +9,7 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" log_usec = true; } metric = { @@ -22,23 +22,23 @@ metric = { } worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 task_timeout = 10s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } modules { - path = "${TESTDIR}/../../src/plugins/lua/" + path = "{= env.TESTDIR =}/../../src/plugins/lua/" } -lua = "${TESTDIR}/lua/test_coverage.lua"; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; neural { rules { @@ -78,8 +78,8 @@ neural { } redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; expand_keys = true; } -lua = "${TESTDIR}/lua/neural.lua"; +lua = "{= env.TESTDIR =}/lua/neural.lua"; diff --git a/test/functional/configs/nginx.conf b/test/functional/configs/nginx.conf index 72472d16e..9a27f4924 100644 --- a/test/functional/configs/nginx.conf +++ b/test/functional/configs/nginx.conf @@ -1,8 +1,8 @@ events { } worker_processes 1; -pid ${TMPDIR}/nginx.pid; -error_log ${TMPDIR}/error.log; +pid ${RSPAMD_TMPDIR}/nginx.pid; +error_log ${RSPAMD_TMPDIR}/error.log; http { default_type application/octet-stream; sendfile on; @@ -13,7 +13,7 @@ http { server_name localhost; location / { - root ${TMPDIR}; + root ${RSPAMD_TMPDIR}; autoindex on; } } diff --git a/test/functional/configs/p0f.conf b/test/functional/configs/p0f.conf index 69303772a..cb492f9b7 100644 --- a/test/functional/configs/p0f.conf +++ b/test/functional/configs/p0f.conf @@ -1,8 +1,10 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; } p0f { - socket = "${P0F_SOCKET}"; + socket = "{= env.P0F_SOCKET =}"; patterns { WINDOWS = '^Windows.*'; ETHER = '^Ethernet.*'; diff --git a/test/functional/configs/password.conf b/test/functional/configs/password.conf index 922301844..27b88eec3 100644 --- a/test/functional/configs/password.conf +++ b/test/functional/configs/password.conf @@ -1,7 +1,7 @@ options = { filters = ["spf", "dkim", "regexp"] - url_tld = "${TESTDIR}/../lua/unit/test_tld.dat" - pidfile = "${TMPDIR}/rspamd.pid" + url_tld = "{= env.TESTDIR =}/../lua/unit/test_tld.dat" + pidfile = "{= env.TMPDIR =}/rspamd.pid" dns { retransmits = 10; timeout = 2s; @@ -10,7 +10,7 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" } metric = { name = "default", @@ -22,24 +22,24 @@ metric = { worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 keypair { - pubkey = "${KEY_PUB1}"; - privkey = "${KEY_PVT1}"; + pubkey = "{= env.KEY_PUB1 =}"; + privkey = "{= env.KEY_PVT1 =}"; } task_timeout = 60s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 keypair { - pubkey = "${KEY_PUB1}"; - privkey = "${KEY_PVT1}"; + pubkey = "{= env.KEY_PUB1 =}"; + privkey = "{= env.KEY_PVT1 =}"; } - password = ${PASSWORD}; - enable_password = ${ENABLE_PASSWORD}; - stats_path = "${TMPDIR}/stats.ucl"; + password = {= env.PASSWORD =}; + enable_password = {= env.ENABLE_PASSWORD =}; + stats_path = "{= env.TMPDIR =}/stats.ucl"; } -lua = "${TESTDIR}/lua/test_coverage.lua"; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; diff --git a/test/functional/configs/phishing.conf b/test/functional/configs/phishing.conf index 2b029f687..aa6eb8fe9 100644 --- a/test/functional/configs/phishing.conf +++ b/test/functional/configs/phishing.conf @@ -1,11 +1,13 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + phishing { symbol = "PHISHING"; strict_domains = { STRICT_PHISHING = [ - "${TESTDIR}/configs/maps/strict.phishing", + "{= env.TESTDIR =}/configs/maps/strict.phishing", ]; STRICTER_PHISHING = [ - "${TESTDIR}/configs/maps/stricter.phishing" + "{= env.TESTDIR =}/configs/maps/stricter.phishing" ] } } diff --git a/test/functional/configs/plugins.conf b/test/functional/configs/plugins.conf index 35a2ce347..803eccefe 100644 --- a/test/functional/configs/plugins.conf +++ b/test/functional/configs/plugins.conf @@ -1,8 +1,8 @@ options = { filters = [ "dkim", "regexp"] - url_tld = "${URL_TLD}" - pidfile = "${TMPDIR}/rspamd.pid" - lua_path = "${INSTALLROOT}/share/rspamd/lib/?.lua" + url_tld = "{= env.URL_TLD =}" + pidfile = "{= env.TMPDIR =}/rspamd.pid" + lua_path = "{= env.INSTALLROOT =}/share/rspamd/lib/?.lua" explicit_modules = ["settings", "bayes_expiry"]; dns { nameserver = ["8.8.8.8", "8.8.4.4"]; @@ -732,7 +732,7 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" log_usec = true; } metric = { @@ -745,21 +745,20 @@ metric = { } worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 task_timeout = 10s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } modules { - path = "${TESTDIR}/../../src/plugins/lua/" + path = "{= env.TESTDIR =}/../../src/plugins/lua/" } spf {} -lua = "${TESTDIR}/lua/test_coverage.lua"; -lua = "${INSTALLROOT}/share/rspamd/rules/rspamd.lua" -${PLUGIN_CONFIG} +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; +lua = "{= env.INSTALLROOT =}/share/rspamd/rules/rspamd.lua"; diff --git a/test/functional/configs/pluginsplus.conf b/test/functional/configs/pluginsplus.conf deleted file mode 100644 index 6422f9f42..000000000 --- a/test/functional/configs/pluginsplus.conf +++ /dev/null @@ -1,41 +0,0 @@ -options = { - filters = ["spf", "dkim", "regexp"] - url_tld = "${URL_TLD}" - pidfile = "${TMPDIR}/rspamd.pid" - lua_path = "${INSTALLROOT}/share/rspamd/lib/?.lua" - dns { - nameserver = ["8.8.8.8", "8.8.4.4"]; - retransmits = 10; - timeout = 2s; - } -} -logging = { - type = "file", - level = "debug" - filename = "${TMPDIR}/rspamd.log" -} -metric = { - name = "default", - actions = { - reject = 100500, - } - unknown_weight = 1 -} -worker { - type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} - count = 1 - task_timeout = 60s; -} -worker { - type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} - count = 1 - secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" -} -modules { - path = "${TESTDIR}/../../src/plugins/lua/" -} -lua = "${LUA}"; -${PLUGIN_CONFIG} diff --git a/test/functional/configs/proxy.conf b/test/functional/configs/proxy.conf index c2bb3902d..ff31eaea0 100644 --- a/test/functional/configs/proxy.conf +++ b/test/functional/configs/proxy.conf @@ -1,8 +1,8 @@ options = { filters = ["spf", "dkim", "regexp"] - url_tld = "${URL_TLD}" - pidfile = "${TMPDIR}/rspamd.pid" - lua_path = "${INSTALLROOT}/share/rspamd/lib/?.lua" + url_tld = "{= env.URL_TLD =}" + pidfile = "{= env.TMPDIR =}/rspamd.pid" + lua_path = "{= env.INSTALLROOT =}/share/rspamd/lib/?.lua" dns { nameserver = ["8.8.8.8", "8.8.4.4"]; retransmits = 10; @@ -12,15 +12,15 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" } worker "rspamd_proxy" { - bind_socket = "${LOCAL_ADDR}:${PORT_PROXY}"; + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_PROXY =}"; upstream { - name = "${LOCAL_ADDR}"; + name = "{= env.LOCAL_ADDR =}"; default = yes; - hosts = "${LOCAL_ADDR}:${PORT_NORMAL}"; + hosts = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}"; } count = 1; } -lua = "${TESTDIR}/lua/test_coverage.lua"; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; diff --git a/test/functional/configs/rbl.conf b/test/functional/configs/rbl.conf index 4999e60d7..c5caa2e50 100644 --- a/test/functional/configs/rbl.conf +++ b/test/functional/configs/rbl.conf @@ -1,3 +1,5 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + rbl { rbls { fake { @@ -33,7 +35,7 @@ rbl { } RSPAMD_EMAILBL { rbl = "test8.uribl"; - url_compose_map = "${TESTDIR}/configs/maps/url_compose_map_for_mails.list"; + url_compose_map = "{= env.TESTDIR =}/configs/maps/url_compose_map_for_mails.list"; ignore_defaults = true; emails = true; emails_domainonly = true diff --git a/test/functional/configs/redis-server.conf b/test/functional/configs/redis-server.conf index 0636a36ef..094302575 100644 --- a/test/functional/configs/redis-server.conf +++ b/test/functional/configs/redis-server.conf @@ -1,7 +1,7 @@ -bind ${REDIS_ADDR} +bind ${RSPAMD_REDIS_ADDR} daemonize yes loglevel debug -logfile ${TMPDIR}/redis.log -pidfile ${TMPDIR}/redis.pid -port ${REDIS_PORT} -dir ${TMPDIR} +logfile ${RSPAMD_TMPDIR}/redis.log +pidfile ${RSPAMD_TMPDIR}/redis.pid +port ${RSPAMD_REDIS_PORT} +dir ${RSPAMD_TMPDIR} diff --git a/test/functional/configs/redis.conf b/test/functional/configs/redis.conf index 2da10faf7..8b3f0c484 100644 --- a/test/functional/configs/redis.conf +++ b/test/functional/configs/redis.conf @@ -1,5 +1,7 @@ -lua = ${LUA_SCRIPT}; +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + +lua = "{= env.LUA_SCRIPT =}"; redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; expand_keys = true; } diff --git a/test/functional/configs/regexp.conf b/test/functional/configs/regexp.conf index 5b4047b5b..06f22c998 100644 --- a/test/functional/configs/regexp.conf +++ b/test/functional/configs/regexp.conf @@ -1,6 +1,8 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + regexp { SA_BODY_WORD_BOUNDARY_ON_NEWLINE { - re = '/\\bhello\\s/{sa_body}', + re = '/\bhello\s/{sa_body}', score = 0.0, description = 'Test if word boundary works correctly on sa_body regexes', group = 'body', @@ -24,25 +26,25 @@ regexp { group = 'body', } SA_BODY_WORD_WITH_SPACE_BOUNDARIES { - re = '/\\bhello world\\b/{sa_body}', + re = '/\bhello world\b/{sa_body}', score = 0.0, description = 'Test if regex matches word separated with newline (should work - newline is replaced with space)', group = 'body', } SA_BODY_WORD_WITH_SPACE_BOUNDARIES_2 { - re = '/\\shello\\sworld\\s/{sa_body}', + re = '/\shello\sworld\s/{sa_body}', score = 0.0, description = 'Test if regex matches word separated with newline (should work - newline is replaced with space)', group = 'body', } SA_BODY_WORD_WITH_SPACE_BOUNDARIES_3 { - re = '/\\shello\\sworld\\sthis\\s/{sa_body}', + re = '/\shello\sworld\sthis\s/{sa_body}', score = 0.0, description = 'Test if regex matches word separated with newline (should work - newline is replaced with space)', group = 'body', } SA_BODY_WORD_WITH_SPACE_AND_DOT { - re = '/\\bword\\.\\sagain\\b/{sa_body}', + re = '/\bword\.\sagain\b/{sa_body}', score = 0.0, description = 'Test if regex matches word separated with newline (should work - newline is replaced with space)', group = 'body', @@ -50,13 +52,13 @@ regexp { } options { - dynamic_conf = "${TESTDIR}/configs/dynamic.conf"; + dynamic_conf = "{= env.TESTDIR =}/configs/dynamic.conf"; } dmarc { } spf { } dkim { } modules { - path = "${TESTDIR}/../../src/plugins/lua/" + path = "{= env.TESTDIR =}/../../src/plugins/lua/" } -lua = "${TESTDIR}/lua/regex_test.lua" +lua = "{= env.TESTDIR =}/lua/regex_test.lua" diff --git a/test/functional/configs/selector.conf b/test/functional/configs/selector.conf index d4e872d36..b99ae5639 100644 --- a/test/functional/configs/selector.conf +++ b/test/functional/configs/selector.conf @@ -1,3 +1,5 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + regexp { CONFIG_SELECTOR_RE_RCPT_SUBJECT { re = 'test=/test@user.com some subject/$', @@ -5,4 +7,4 @@ regexp { } } -lua = "${TESTDIR}/lua/selector_test.lua" +lua = "{= env.TESTDIR =}/lua/selector_test.lua" diff --git a/test/functional/configs/settings.conf b/test/functional/configs/settings.conf index 8155ded91..db7c3ca5e 100644 --- a/test/functional/configs/settings.conf +++ b/test/functional/configs/settings.conf @@ -1,4 +1,6 @@ -lua = ${LUA_SCRIPT}; +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + +lua = "{= env.LUA_SCRIPT =}"; settings { id_test { diff --git a/test/functional/configs/spamassassin.conf b/test/functional/configs/spamassassin.conf index 53aa89ec7..0b669512a 100644 --- a/test/functional/configs/spamassassin.conf +++ b/test/functional/configs/spamassassin.conf @@ -1,5 +1,7 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + spamassassin { - rules = "${TESTDIR}/configs/spamassassin.rules" + rules = "{= env.TESTDIR =}/configs/spamassassin.rules" } -lua = "${TESTDIR}/lua/test_coverage.lua"; -lua = "${TESTDIR}/lua/simple.lua" +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; +lua = "{= env.TESTDIR =}/lua/simple.lua" diff --git a/test/functional/configs/stats.conf b/test/functional/configs/stats.conf index f79729f39..bfa39b426 100644 --- a/test/functional/configs/stats.conf +++ b/test/functional/configs/stats.conf @@ -1,7 +1,7 @@ options = { filters = ["spf", "dkim", "regexp"] - url_tld = "${TESTDIR}/../lua/unit/test_tld.dat" - pidfile = "${TMPDIR}/rspamd.pid" + url_tld = "{= env.TESTDIR =}/../lua/unit/test_tld.dat" + pidfile = "{= env.TMPDIR =}/rspamd.pid" dns { retransmits = 10; timeout = 2s; @@ -15,7 +15,7 @@ options = { logging = { type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log" + filename = "{= env.TMPDIR =}/rspamd.log" } metric = { name = "default", @@ -27,51 +27,51 @@ metric = { worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 keypair { - pubkey = "${KEY_PUB1}"; - privkey = "${KEY_PVT1}"; + pubkey = "{= env.KEY_PUB1 =}"; + privkey = "{= env.KEY_PVT1 =}"; } task_timeout = 60s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 keypair { - pubkey = "${KEY_PUB1}"; - privkey = "${KEY_PVT1}"; + pubkey = "{= env.KEY_PUB1 =}"; + privkey = "{= env.KEY_PVT1 =}"; } secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl"; + stats_path = "{= env.TMPDIR =}/stats.ucl"; } classifier { languages_enabled = true; tokenizer { name = "osb"; - ${STATS_HASH} - ${STATS_KEY} + hash = {= env.STATS_HASH =}; + key = {= env.STATS_KEY =}; } - backend = ${STATS_BACKEND} + backend = "{= env.STATS_BACKEND =}"; statfile { spam = true; symbol = BAYES_SPAM; size = 1M; - ${REDIS_SERVER} + server = {= env.REDIS_SERVER =} } statfile { spam = false; symbol = BAYES_HAM; size = 1M; - ${REDIS_SERVER} + server = {= env.REDIS_SERVER =} } cache { - ${REDIS_SERVER} + server = {= env.REDIS_SERVER =} } } -lua = "${TESTDIR}/lua/test_coverage.lua"; +lua = "{= env.TESTDIR =}/lua/test_coverage.lua"; settings {} diff --git a/test/functional/configs/surbl.conf b/test/functional/configs/surbl.conf index 6e3a40e18..fe6368277 100644 --- a/test/functional/configs/surbl.conf +++ b/test/functional/configs/surbl.conf @@ -1,3 +1,5 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + surbl { "whitelist" = [ "rspamd-test.com" @@ -66,7 +68,7 @@ EOD; } "BAD_SUBDOMAIN" { suffix = "test7.uribl"; - url_compose_map = "${TESTDIR}/configs/maps/url_compose_map.list"; + url_compose_map = "{= env.TESTDIR =}/configs/maps/url_compose_map.list"; check_dkim = true; check_emails = false; } @@ -88,4 +90,4 @@ emails { replyto = true; } } -}
\ No newline at end of file +} diff --git a/test/functional/configs/trivial.conf b/test/functional/configs/trivial.conf index 5d4aa0af6..97e3a301e 100644 --- a/test/functional/configs/trivial.conf +++ b/test/functional/configs/trivial.conf @@ -1,8 +1,8 @@ options = { filters = ["spf", "dkim", "regexp"] - url_tld = "${TESTDIR}/../lua/unit/test_tld.dat" - pidfile = "${TMPDIR}/rspamd.pid"; - lua_path = "${INSTALLROOT}/share/rspamd/lib/?.lua"; + url_tld = "{= env.TESTDIR =}/../lua/unit/test_tld.dat" + pidfile = "{= env.TMPDIR =}/rspamd.pid"; + lua_path = "{= env.INSTALLROOT =}/share/rspamd/lib/?.lua"; dns { nameserver = ["8.8.8.8", "8.8.4.4"]; retransmits = 10; @@ -13,7 +13,7 @@ logging = { log_urls = true; type = "file", level = "debug" - filename = "${TMPDIR}/rspamd.log"; + filename = "{= env.TMPDIR =}/rspamd.log"; log_usec = true; } metric = { @@ -26,25 +26,25 @@ metric = { worker { type = normal - bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}" count = 1 keypair { - pubkey = "${KEY_PUB1}"; - privkey = "${KEY_PVT1}"; + pubkey = "{= env.KEY_PUB1 =}"; + privkey = "{= env.KEY_PVT1 =}"; } task_timeout = 10s; } worker { type = controller - bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER} + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}" count = 1 secure_ip = ["127.0.0.1", "::1"]; - stats_path = "${TMPDIR}/stats.ucl" + stats_path = "{= env.TMPDIR =}/stats.ucl" } modules { - path = "${TESTDIR}/../../src/plugins/lua/" + path = "{= env.TESTDIR =}/../../src/plugins/lua/" } -lua = "${INSTALLROOT}/share/rspamd/rules/rspamd.lua" +lua = "{= env.INSTALLROOT =}/share/rspamd/rules/rspamd.lua" diff --git a/test/functional/configs/url_redirector.conf b/test/functional/configs/url_redirector.conf index f61fa3086..e6009ba66 100644 --- a/test/functional/configs/url_redirector.conf +++ b/test/functional/configs/url_redirector.conf @@ -1,6 +1,8 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; } url_redirector { - redirector_hosts_map = "${TESTDIR}/configs/maps/redir.map"; + redirector_hosts_map = "{= env.TESTDIR =}/configs/maps/redir.map"; } diff --git a/test/functional/configs/url_tags.conf b/test/functional/configs/url_tags.conf index ca3d2e34b..9c82b84e4 100644 --- a/test/functional/configs/url_tags.conf +++ b/test/functional/configs/url_tags.conf @@ -1,7 +1,7 @@ url_tags { } redis { - servers = "${REDIS_ADDR}:${REDIS_PORT}"; + servers = "${RSPAMD_REDIS_ADDR}:${RSPAMD_REDIS_PORT}"; } options { diff --git a/test/functional/configs/whitelist.conf b/test/functional/configs/whitelist.conf index d7592fc35..db264aa42 100644 --- a/test/functional/configs/whitelist.conf +++ b/test/functional/configs/whitelist.conf @@ -1,3 +1,5 @@ +.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" + dmarc {} spf {} whitelist { @@ -9,7 +11,7 @@ whitelist { valid_dmarc = true; valid_spf = true; domains = [ - "${TESTDIR}/configs/maps/domains.list", + "{= env.TESTDIR =}/configs/maps/domains.list", ]; score = -3.0; inverse_symbol = "BLACKLIST_DDS"; @@ -18,7 +20,7 @@ whitelist { "WHITELIST_DKIM" = { valid_dkim = true; domains = [ - "${TESTDIR}/configs/maps/domains.list", + "{= env.TESTDIR =}/configs/maps/domains.list", ]; description = "Mail comes from the whitelisted domain and has a valid DKIM signature"; score = -1.0; @@ -28,7 +30,7 @@ whitelist { "WHITELIST_SPF" = { valid_spf = true; domains = [ - "${TESTDIR}/configs/maps/domains.list", + "{= env.TESTDIR =}/configs/maps/domains.list", ]; score = -1.0 inverse_multiplier = 3.0 @@ -40,7 +42,7 @@ whitelist { valid_spf = true; valid_dkim = true; domains = [ - "${TESTDIR}/configs/maps/domains.list" + "{= env.TESTDIR =}/configs/maps/domains.list" ]; score = -3.0; description = "Mail comes from the whitelisted domain and has a valid SPF policy and valid DKIM signature"; @@ -51,7 +53,7 @@ whitelist { valid_dmarc = true; valid_dkim = true; domains = [ - "${TESTDIR}/configs/maps/domains.list", + "{= env.TESTDIR =}/configs/maps/domains.list", ]; score = -2.0; description = "Mail comes from the whitelisted domain and has valid DMARC and DKIM policies"; @@ -61,7 +63,7 @@ whitelist { "WHITELIST_DMARC" = { valid_dmarc = true; domains = [ - "${TESTDIR}/configs/maps/domains.list", + "{= env.TESTDIR =}/configs/maps/domains.list", ]; score = -2.0; description = "Mail comes from the whitelisted domain and has valid DMARC policy"; @@ -72,7 +74,7 @@ whitelist { strict = true; valid_dmarc = true; domains = [ - "${TESTDIR}/configs/maps/domains.list", + "{= env.TESTDIR =}/configs/maps/domains.list", ]; score = -3.0; } diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py index ce05bdc8a..f938ba124 100644 --- a/test/functional/lib/rspamd.py +++ b/test/functional/lib/rspamd.py @@ -106,7 +106,7 @@ def make_temporary_directory(): """Creates and returns a unique temporary directory Example: - | ${TMPDIR} = | Make Temporary Directory | + | ${RSPAMD_TMPDIR} = | Make Temporary Directory | """ dirname = tempfile.mkdtemp() os.chmod(dirname, stat.S_IRUSR | @@ -140,8 +140,8 @@ def rspamc(addr, port, filename): return r.decode('utf-8') def Scan_File(filename, **headers): - addr = BuiltIn().get_variable_value("${LOCAL_ADDR}") - port = BuiltIn().get_variable_value("${PORT_NORMAL}") + addr = BuiltIn().get_variable_value("${RSPAMD_LOCAL_ADDR}") + port = BuiltIn().get_variable_value("${RSPAMD_PORT_NORMAL}") headers["Queue-Id"] = BuiltIn().get_variable_value("${TEST_NAME}") c = http.client.HTTPConnection("%s:%s" % (addr, port)) c.request("POST", "/checkv2", open(filename, "rb"), headers) @@ -314,7 +314,7 @@ LUA_STATSFILE = "luacov.stats.out" def collect_lua_coverage(): """ - Merges ${TMPDIR}/*.luacov.stats.out into luacov.stats.out + Merges ${RSPAMD_TMPDIR}/*.luacov.stats.out into luacov.stats.out Example: | Collect Lua Coverage | @@ -324,7 +324,7 @@ def collect_lua_coverage(): # logger.info("ENABLE_LUA_COVERAGE is not present in env, will not collect Lua coverage") # return - tmp_dir = BuiltIn().get_variable_value("${TMPDIR}") + tmp_dir = BuiltIn().get_variable_value("${RSPAMD_TMPDIR}") coverage = {} input_files = [] diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index c52bcc51a..865245e62 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -5,7 +5,7 @@ Library Process *** Keywords *** Check Controller Errors - @{result} = HTTP GET ${LOCAL_ADDR} ${PORT_CONTROLLER} /errors + @{result} = HTTP GET ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_CONTROLLER} /errors Should Be Equal As Integers ${result}[0] 200 Log ${result}[1] @@ -56,16 +56,6 @@ Do Not Expect Symbols ... msg=Symbol ${symbol} was not expected to be found in result END -Generic Setup - [Arguments] @{vargs} &{kwargs} - &{d} = Run Rspamd @{vargs} &{kwargs} - ${keys} = Get Dictionary Keys ${d} - FOR ${i} IN @{keys} - Run Keyword If '${RSPAMD_SCOPE}' == 'Suite' Set Suite Variable ${${i}} ${d}[${i}] - ... ELSE IF '${RSPAMD_SCOPE}' == 'Test' Set Test Variable ${${i}} ${d}[${i}] - ... ELSE Fail 'RSPAMD_SCOPE must be Test or Suite' - END - Expect Action [Arguments] ${action} Should Be Equal ${SCAN_RESULT}[action] ${action} @@ -126,6 +116,13 @@ Expect Symbol With Score Should Be Equal As Numbers ${SCAN_RESULT}[symbols][${symbol}][score] ${score} ... msg="Symbol ${symbol} has score of ${SCAN_RESULT}[symbols][${symbol}][score] but expected ${score}" +Expect Symbols + [Arguments] @{symbols} + FOR ${symbol} IN @{symbols} + Dictionary Should Contain Key ${SCAN_RESULT}[symbols] ${symbol} + ... msg=Symbol ${symbol} wasn't found in result + END + Expect Symbols With Scores [Arguments] &{symscores} FOR ${key} ${value} IN &{symscores} @@ -140,24 +137,28 @@ Expect Symbol With Score And Exact Options Expect Symbol With Exact Options ${symbol} @{options} Expect Symbol With Score ${symbol} ${score} -Generic Teardown - Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Check Controller Errors - Shutdown Process With Children ${RSPAMD_PID} - Save Run Results ${TMPDIR} rspamd.conf rspamd.log redis.log clickhouse-config.xml - Log does not contain segfault record - Collect Lua Coverage - Cleanup Temporary Directory ${TMPDIR} +Export Rspamd Variables To Environment + &{all_vars} = Get Variables no_decoration=True + FOR ${k} ${v} IN &{all_vars} + Run Keyword If '${k}'.startswith("RSPAMD_") Set Environment Variable ${k} ${v} + END + +Export Scoped Variables + [Arguments] ${scope} &{vars} + FOR ${k} ${v} IN &{vars} + Run Keyword If '${scope}' == 'Test' Set Test Variable ${${k}} ${v} + ... ELSE IF '${scope}' == 'Suite' Set Suite Variable ${${k}} ${v} + ... ELSE IF '${scope}' == 'Global' Set Global Variable ${${k}} ${v} + ... ELSE Fail message="Don't know what to do with scope: ${scope}" + END Log does not contain segfault record - ${log} = Get File ${TMPDIR}/rspamd.log encoding_errors=ignore + ${log} = Get File ${RSPAMD_TMPDIR}/rspamd.log encoding_errors=ignore Should not contain ${log} Segmentation fault: msg=Segmentation fault detected -Normal Teardown - Generic Teardown - Redis HSET [Arguments] ${hash} ${key} ${value} - ${result} = Run Process redis-cli -h ${REDIS_ADDR} -p ${REDIS_PORT} + ${result} = Run Process redis-cli -h ${RSPAMD_REDIS_ADDR} -p ${RSPAMD_REDIS_PORT} ... HSET ${hash} ${key} ${value} Run Keyword If ${result.rc} != 0 Log ${result.stderr} Log ${result.stdout} @@ -165,84 +166,118 @@ Redis HSET Redis SET [Arguments] ${key} ${value} - ${result} = Run Process redis-cli -h ${REDIS_ADDR} -p ${REDIS_PORT} + ${result} = Run Process redis-cli -h ${RSPAMD_REDIS_ADDR} -p ${RSPAMD_REDIS_PORT} ... SET ${key} ${value} Run Keyword If ${result.rc} != 0 Log ${result.stderr} Log ${result.stdout} Should Be Equal As Integers ${result.rc} 0 +Redis Teardown + ${redis_pid} = Get Variable Value ${REDIS_PID} + Shutdown Process With Children ${redis_pid} + Cleanup Temporary Directory ${REDIS_TMPDIR} + +Rspamd Setup + # Create and chown temporary directory + ${RSPAMD_TMPDIR} = Make Temporary Directory + Set Directory Ownership ${RSPAMD_TMPDIR} ${RSPAMD_USER} ${RSPAMD_GROUP} + + # Export ${RSPAMD_TMPDIR} to appropriate scope according to ${RSPAMD_SCOPE} + Export Scoped Variables ${RSPAMD_SCOPE} RSPAMD_TMPDIR=${RSPAMD_TMPDIR} + + Run Rspamd + +Rspamd Redis Setup + Run Redis + Rspamd Setup + +Rspamd Teardown + # Robot Framework 4.0 + #Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Run Keyword And Warn On Failure Check Controller Errors + Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Check Controller Errors + Shutdown Process With Children ${RSPAMD_PID} + Save Run Results ${RSPAMD_TMPDIR} rspamd.conf rspamd.log redis.log clickhouse-config.xml + Log does not contain segfault record + Collect Lua Coverage + Cleanup Temporary Directory ${RSPAMD_TMPDIR} + +Rspamd Redis Teardown + Rspamd Teardown + Redis Teardown + Run Redis - ${template} = Get File ${TESTDIR}/configs/redis-server.conf + ${RSPAMD_TMPDIR} = Make Temporary Directory + ${template} = Get File ${RSPAMD_TESTDIR}/configs/redis-server.conf ${config} = Replace Variables ${template} - Create File ${TMPDIR}/redis-server.conf ${config} + Create File ${RSPAMD_TMPDIR}/redis-server.conf ${config} Log ${config} - ${result} = Run Process redis-server ${TMPDIR}/redis-server.conf + ${result} = Run Process redis-server ${RSPAMD_TMPDIR}/redis-server.conf Run Keyword If ${result.rc} != 0 Log ${result.stderr} Should Be Equal As Integers ${result.rc} 0 - Wait Until Keyword Succeeds 5x 1 sec Check Pidfile ${TMPDIR}/redis.pid timeout=0.5s - Wait Until Keyword Succeeds 5x 1 sec Redis Check ${REDIS_ADDR} ${REDIS_PORT} - ${REDIS_PID} = Get File ${TMPDIR}/redis.pid - Run Keyword If '${REDIS_SCOPE}' == 'Test' Set Test Variable ${REDIS_PID} - ... ELSE IF '${REDIS_SCOPE}' == 'Suite' Set Suite Variable ${REDIS_PID} - ${redis_log} = Get File ${TMPDIR}/redis.log + Wait Until Keyword Succeeds 5x 1 sec Check Pidfile ${RSPAMD_TMPDIR}/redis.pid timeout=0.5s + Wait Until Keyword Succeeds 5x 1 sec Redis Check ${RSPAMD_REDIS_ADDR} ${RSPAMD_REDIS_PORT} + ${REDIS_PID} = Get File ${RSPAMD_TMPDIR}/redis.pid + ${REDIS_PID} = Convert To Number ${REDIS_PID} + Export Scoped Variables ${REDIS_SCOPE} REDIS_PID=${REDIS_PID} REDIS_TMPDIR=${RSPAMD_TMPDIR} + ${redis_log} = Get File ${RSPAMD_TMPDIR}/redis.log Log ${redis_log} +Run Rspamd + Export Rspamd Variables To Environment + + # Dump templated config or errors to log + ${result} = Run Process ${RSPAMADM} configdump -c ${CONFIG} + # We need to send output to files (or discard output) to avoid hanging Robot + ... stdout=${RSPAMD_TMPDIR}/configdump.stdout stderr=${RSPAMD_TMPDIR}/configdump.stderr + ${configdump} = Run Keyword If ${result.rc} == 0 Get File ${RSPAMD_TMPDIR}/configdump.stdout + ... ELSE Get File ${RSPAMD_TMPDIR}/configdump.stderr + Log ${configdump} + + # Fix directory ownership (maybe do this somewhere else) + Set Directory Ownership ${RSPAMD_TMPDIR} ${RSPAMD_USER} ${RSPAMD_GROUP} + + # Run Rspamd + ${result} = Run Process ${RSPAMD} -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} + ... -c ${CONFIG} env:TMPDIR=${RSPAMD_TMPDIR} env:DBDIR=${RSPAMD_TMPDIR} env:LD_LIBRARY_PATH=${RSPAMD_TESTDIR}/../../contrib/aho-corasick + # We need to send output to files (or discard output) to avoid hanging Robot + ... stdout=${RSPAMD_TMPDIR}/rspamd.stdout stderr=${RSPAMD_TMPDIR}/rspamd.stderr + + # Abort if it failed + Should Be Equal As Integers ${result.rc} 0 + + # Wait for pid file to be written + Wait Until Keyword Succeeds 10x 1 sec Check Pidfile ${RSPAMD_TMPDIR}/rspamd.pid timeout=0.5s + + # Confirm worker is reachable + Wait Until Keyword Succeeds 5x 1 sec Ping Rspamd ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} + + # Read PID from PIDfile and export it to appropriate scope as ${RSPAMD_PID} + ${RSPAMD_PID} = Get File ${RSPAMD_TMPDIR}/rspamd.pid + Export Scoped Variables ${RSPAMD_SCOPE} RSPAMD_PID=${RSPAMD_PID} + Run Nginx - ${template} = Get File ${TESTDIR}/configs/nginx.conf + ${template} = Get File ${RSPAMD_TESTDIR}/configs/nginx.conf ${config} = Replace Variables ${template} - Create File ${TMPDIR}/nginx.conf ${config} + Create File ${RSPAMD_TMPDIR}/nginx.conf ${config} Log ${config} - ${result} = Run Process nginx -c ${TMPDIR}/nginx.conf + ${result} = Run Process nginx -c ${RSPAMD_TMPDIR}/nginx.conf Run Keyword If ${result.rc} != 0 Log ${result.stderr} Should Be Equal As Integers ${result.rc} 0 - Wait Until Keyword Succeeds 10x 1 sec Check Pidfile ${TMPDIR}/nginx.pid timeout=0.5s + Wait Until Keyword Succeeds 10x 1 sec Check Pidfile ${RSPAMD_TMPDIR}/nginx.pid timeout=0.5s Wait Until Keyword Succeeds 5x 1 sec TCP Connect ${NGINX_ADDR} ${NGINX_PORT} - ${NGINX_PID} = Get File ${TMPDIR}/nginx.pid + ${NGINX_PID} = Get File ${RSPAMD_TMPDIR}/nginx.pid Run Keyword If '${NGINX_SCOPE}' == 'Test' Set Test Variable ${NGINX_PID} ... ELSE IF '${NGINX_SCOPE}' == 'Suite' Set Suite Variable ${NGINX_PID} - ${nginx_log} = Get File ${TMPDIR}/nginx.log + ${nginx_log} = Get File ${RSPAMD_TMPDIR}/nginx.log Log ${nginx_log} Run Rspamc [Arguments] @{args} ${result} = Run Process ${RSPAMC} -t 60 --header Queue-ID\=${TEST NAME} - ... @{args} env:LD_LIBRARY_PATH=${TESTDIR}/../../contrib/aho-corasick + ... @{args} env:LD_LIBRARY_PATH=${RSPAMD_TESTDIR}/../../contrib/aho-corasick Log ${result.stdout} [Return] ${result} -Run Rspamd - [Arguments] @{vargs} &{kwargs} - ${has_CONFIG} = Evaluate 'CONFIG' in $kwargs - ${has_TMPDIR} = Evaluate 'TMPDIR' in $kwargs - ${CONFIG} = Set Variable If '${has_CONFIG}' == 'True' ${kwargs}[CONFIG] ${CONFIG} - &{d} = Create Dictionary - ${tmpdir} = Run Keyword If '${has_TMPDIR}' == 'True' Set Variable ${kwargs}[TMPDIR] - ... ELSE Make Temporary Directory - Set Directory Ownership ${tmpdir} ${RSPAMD_USER} ${RSPAMD_GROUP} - ${template} = Get File ${CONFIG} - # TODO: stop using this; we have Lupa now - FOR ${i} IN @{vargs} - ${newvalue} = Replace Variables ${${i}} - Set To Dictionary ${d} ${i}=${newvalue} - END - ${config} = Replace Variables ${template} - ${config} = Replace Variables ${config} - Log ${config} - Create File ${tmpdir}/rspamd.conf ${config} - ${result} = Run Process ${RSPAMD} -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} - ... -c ${tmpdir}/rspamd.conf env:TMPDIR=${tmpdir} env:DBDIR=${tmpdir} env:LD_LIBRARY_PATH=${TESTDIR}/../../contrib/aho-corasick - ... env:RSPAMD_INSTALLROOT=${INSTALLROOT} stdout=DEVNULL stderr=DEVNULL - Run Keyword If ${result.rc} != 0 Log ${result.stderr} - Should Be Equal As Integers ${result.rc} 0 - Wait Until Keyword Succeeds 10x 1 sec Check Pidfile ${tmpdir}/rspamd.pid timeout=0.5s - Wait Until Keyword Succeeds 5x 1 sec Ping Rspamd ${LOCAL_ADDR} ${PORT_NORMAL} - ${rspamd_pid} = Get File ${tmpdir}/rspamd.pid - Set To Dictionary ${d} RSPAMD_PID=${rspamd_pid} TMPDIR=${tmpdir} - [Return] &{d} - -Simple Teardown - Generic Teardown - Scan File By Reference [Arguments] ${filename} &{headers} Set To Dictionary ${headers} File=${filename} @@ -251,14 +286,14 @@ Scan File By Reference Scan Message With Rspamc [Arguments] ${msg_file} @{vargs} - ${result} = Run Rspamc -p -h ${LOCAL_ADDR}:${PORT_NORMAL} @{vargs} ${msg_file} + ${result} = Run Rspamc -p -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_NORMAL} @{vargs} ${msg_file} [Return] ${result} Sync Fuzzy Storage [Arguments] @{vargs} ${len} = Get Length ${vargs} ${result} = Run Keyword If $len == 0 Run Process ${RSPAMADM} control -s - ... ${TMPDIR}/rspamd.sock fuzzy_sync + ... ${RSPAMD_TMPDIR}/rspamd.sock fuzzy_sync ... ELSE Run Process ${RSPAMADM} control -s ${vargs}[0]/rspamd.sock ... fuzzy_sync Log ${result.stdout} diff --git a/test/functional/lib/vars.py b/test/functional/lib/vars.py index 51690e591..7d57f9f8f 100644 --- a/test/functional/lib/vars.py +++ b/test/functional/lib/vars.py @@ -1,26 +1,26 @@ import socket CONTROLLER_ERRORS = True -KEY_PVT1 = 'ekd3x36tfa5gd76t6pa8hqif3ott7n1siuux68exbkk7ukscte9y' -KEY_PUB1 = 'm8kneubpcjsb8sbsoj7jy7azj9fdd3xmj63txni86a8ye9ncomny' -LOCAL_ADDR = '127.0.0.1' -MAP_WATCH_INTERVAL = '1min' -PORT_CONTROLLER = 56790 -PORT_CONTROLLER_SLAVE = 56793 -PORT_FUZZY = 56791 -PORT_FUZZY_SLAVE = 56792 -PORT_NORMAL = 56789 -PORT_NORMAL_SLAVE = 56794 -PORT_PROXY = 56795 -PORT_CLAM = 2100 -PORT_FPROT = 2101 -PORT_FPROT2_DUPLICATE = 2102 -PORT_AVAST = 2103 -P0F_SOCKET = '/tmp/p0f.sock' -REDIS_ADDR = '127.0.0.1' -REDIS_PORT = 56379 -NGINX_ADDR = '127.0.0.1' -NGINX_PORT = 56380 +RSPAMD_KEY_PVT1 = 'ekd3x36tfa5gd76t6pa8hqif3ott7n1siuux68exbkk7ukscte9y' +RSPAMD_KEY_PUB1 = 'm8kneubpcjsb8sbsoj7jy7azj9fdd3xmj63txni86a8ye9ncomny' +RSPAMD_LOCAL_ADDR = '127.0.0.1' +RSPAMD_MAP_WATCH_INTERVAL = '1min' +RSPAMD_PORT_CONTROLLER = 56790 +RSPAMD_PORT_CONTROLLER_SLAVE = 56793 +RSPAMD_PORT_FUZZY = 56791 +RSPAMD_PORT_FUZZY_SLAVE = 56792 +RSPAMD_PORT_NORMAL = 56789 +RSPAMD_PORT_NORMAL_SLAVE = 56794 +RSPAMD_PORT_PROXY = 56795 +RSPAMD_PORT_CLAM = 2100 +RSPAMD_PORT_FPROT = 2101 +RSPAMD_PORT_FPROT2_DUPLICATE = 2102 +RSPAMD_PORT_AVAST = 2103 +RSPAMD_P0F_SOCKET = '/tmp/p0f.sock' +RSPAMD_REDIS_ADDR = '127.0.0.1' +RSPAMD_REDIS_PORT = 56379 +RSPAMD_NGINX_ADDR = '127.0.0.1' +RSPAMD_NGINX_PORT = 56380 RSPAMD_GROUP = 'nogroup' RSPAMD_USER = 'nobody' SOCK_DGRAM = socket.SOCK_DGRAM |