diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-11-24 09:45:52 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-11-24 09:45:52 +0000 |
commit | b1c611505e3e0bac95570fd76dcfaad21814f319 (patch) | |
tree | 6d76c03715a6eb440d91d75cc0387d900229e3ff /test/lua/rspamd_test_helper.lua | |
parent | f2b56c4defde08e92ca1bf6cf9b26995d32a0d0f (diff) | |
download | rspamd-b1c611505e3e0bac95570fd76dcfaad21814f319.tar.gz rspamd-b1c611505e3e0bac95570fd76dcfaad21814f319.zip |
[Test] Add a simple config helper for the unit tests
Diffstat (limited to 'test/lua/rspamd_test_helper.lua')
-rw-r--r-- | test/lua/rspamd_test_helper.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/lua/rspamd_test_helper.lua b/test/lua/rspamd_test_helper.lua index 80ca2c8f7..4d58d261a 100644 --- a/test/lua/rspamd_test_helper.lua +++ b/test/lua/rspamd_test_helper.lua @@ -15,4 +15,32 @@ function exports.init_url_parser(file) ffi.C.rspamd_url_init(file) end +function exports.default_config() + local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1") + local tld_file = string.format('%s/%s', test_dir, "test_tld.dat") + + local config = { + options = { + filters = {'spf', 'dkim', 'regexp'}, + url_tld = tld_file, + dns = { + nameserver = {'8.8.8.8'} + }, + }, + logging = { + type = 'console', + level = 'debug' + }, + metric = { + name = 'default', + actions = { + reject = 100500, + }, + unknown_weight = 1 + } + } + + return config +end + return exports
\ No newline at end of file |