From 581db041d2a8506581408c376a6edc37f8d2e9ca Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Thu, 4 Aug 2016 11:29:45 +0100 Subject: [PATCH] [Test] Unify some configs --- .../{102_maps.robot => 102_multimap.robot} | 10 ++++-- ...105_archives.robot => 105_mimetypes.robot} | 8 ++++- test/functional/configs/mime_types.conf | 15 +++++++++ .../configs/{maps.conf => multimap.conf} | 31 ------------------- test/functional/configs/plugins.conf | 19 +++--------- 5 files changed, 34 insertions(+), 49 deletions(-) rename test/functional/cases/{102_maps.robot => 102_multimap.robot} (94%) rename test/functional/cases/{105_archives.robot => 105_mimetypes.robot} (79%) create mode 100644 test/functional/configs/mime_types.conf rename test/functional/configs/{maps.conf => multimap.conf} (65%) diff --git a/test/functional/cases/102_maps.robot b/test/functional/cases/102_multimap.robot similarity index 94% rename from test/functional/cases/102_maps.robot rename to test/functional/cases/102_multimap.robot index 1c7bcb3bc..9d02ca666 100644 --- a/test/functional/cases/102_maps.robot +++ b/test/functional/cases/102_multimap.robot @@ -1,12 +1,12 @@ *** Settings *** -Suite Setup Generic Setup +Suite Setup Multimap Setup Suite Teardown Generic Teardown Library ${TESTDIR}/lib/rspamd.py Resource ${TESTDIR}/lib/rspamd.robot Variables ${TESTDIR}/lib/vars.py *** Variables *** -${CONFIG} ${TESTDIR}/configs/maps.conf +${CONFIG} ${TESTDIR}/configs/plugins.conf ${MESSAGE} ${TESTDIR}/messages/spam_message.eml ${UTF_MESSAGE} ${TESTDIR}/messages/utf.eml ${RSPAMD_SCOPE} Suite @@ -113,3 +113,9 @@ MAP - CDB - HOSTNAME MAP - CDB - HOSTNAME MISS ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname rspamd.com Check Rspamc ${result} HOSTNAME_MAP inverse=1 rc_noinverse=1 + +*** Keywords *** +Multimap Setup + ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/multimap.conf + Set Suite Variable ${PLUGIN_CONFIG} + Generic Setup PLUGIN_CONFIG diff --git a/test/functional/cases/105_archives.robot b/test/functional/cases/105_mimetypes.robot similarity index 79% rename from test/functional/cases/105_archives.robot rename to test/functional/cases/105_mimetypes.robot index 16a14bfda..c67784f25 100644 --- a/test/functional/cases/105_archives.robot +++ b/test/functional/cases/105_mimetypes.robot @@ -1,5 +1,5 @@ *** Settings *** -Suite Setup Generic Setup +Suite Setup MIMETypes Setup Suite Teardown Generic Teardown Library ${TESTDIR}/lib/rspamd.py Resource ${TESTDIR}/lib/rspamd.robot @@ -21,3 +21,9 @@ Zip Double Bad Extension Rar4 ${result} = Scan Message With Rspamc ${TESTDIR}/messages/rar4.eml Check Rspamc ${result} MIME_BAD_EXTENSION \\(\\d+\\.\\d+\\)\\[exe\\]\\n re=1 + +*** 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/configs/mime_types.conf b/test/functional/configs/mime_types.conf new file mode 100644 index 000000000..4aa1ac0ef --- /dev/null +++ b/test/functional/configs/mime_types.conf @@ -0,0 +1,15 @@ +mime_types { + file = "${TESTDIR}/../../../conf/mime_types.inc"; + extension_map { + html = "text/html"; + txt [ + "message/disposition-notification", + "text/plain", + "text/rfc822-headers", + ] + pdf [ + "application/octet-stream", + "application/pdf", + ] + } +} diff --git a/test/functional/configs/maps.conf b/test/functional/configs/multimap.conf similarity index 65% rename from test/functional/configs/maps.conf rename to test/functional/configs/multimap.conf index 09a8e8cd7..334b07e02 100644 --- a/test/functional/configs/maps.conf +++ b/test/functional/configs/multimap.conf @@ -1,34 +1,3 @@ -options = { - filters = ["spf", "dkim", "regexp"] - url_tld = "${TESTDIR}/../lua/unit/test_tld.dat" - pidfile = "${TMPDIR}/rspamd.pid" - lua_path = "${TESTDIR}/../../contrib/lua-fun/?.lua" -} -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 - keypair { - pubkey = "${KEY_PUB1}"; - privkey = "${KEY_PVT1}"; - } -} -modules { - path = "${TESTDIR}/../../src/plugins/lua/" -} multimap { DNSBL_MAP { type = "dnsbl"; diff --git a/test/functional/configs/plugins.conf b/test/functional/configs/plugins.conf index 6eded737a..2beb7b764 100644 --- a/test/functional/configs/plugins.conf +++ b/test/functional/configs/plugins.conf @@ -1,5 +1,8 @@ options = { + filters = ["spf", "dkim", "regexp"] + url_tld = "${TESTDIR}/../lua/unit/test_tld.dat" pidfile = "${TMPDIR}/rspamd.pid" + lua_path = "${TESTDIR}/../../contrib/lua-fun/?.lua" } logging = { type = "file", @@ -18,21 +21,7 @@ worker { bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL} count = 1 } -mime_types { - file = "${TESTDIR}/../../../conf/mime_types.inc"; - extension_map { - html = "text/html"; - txt [ - "message/disposition-notification", - "text/plain", - "text/rfc822-headers", - ] - pdf [ - "application/octet-stream", - "application/pdf", - ] - } -} modules { path = "${TESTDIR}/../../src/plugins/lua/" } +${PLUGIN_CONFIG} -- 2.39.5