diff options
author | Andrew Lewis <nerf@judo.za.org> | 2022-02-01 13:09:19 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2022-02-01 13:09:19 +0200 |
commit | 225c8d92b64b76bc122d462966dc35109a399da2 (patch) | |
tree | a79e3f0c6d8496b90f2dab67253c23329589a7a3 | |
parent | c9f263111e58d83f0953881190511d9683ee118b (diff) | |
download | rspamd-225c8d92b64b76bc122d462966dc35109a399da2.tar.gz rspamd-225c8d92b64b76bc122d462966dc35109a399da2.zip |
[Test] task:remove_symbol() on grouped virtual symbol
-rw-r--r-- | test/functional/cases/001_merged/101_lua.robot | 5 | ||||
-rw-r--r-- | test/functional/configs/merged.conf | 1 | ||||
-rw-r--r-- | test/functional/lua/remove_result.lua | 26 |
3 files changed, 32 insertions, 0 deletions
diff --git a/test/functional/cases/001_merged/101_lua.robot b/test/functional/cases/001_merged/101_lua.robot index 23637396a..ac4f8677a 100644 --- a/test/functional/cases/001_merged/101_lua.robot +++ b/test/functional/cases/001_merged/101_lua.robot @@ -34,6 +34,11 @@ Option Order 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 +Remove Result + Scan File ${MESSAGE} Settings={symbols_enabled = [REMOVE_RESULT_EXPECTED, REMOVE_RESULT_UNEXPECTED]} + Expect Symbol REMOVE_RESULT_EXPECTED + Do Not Expect Symbol REMOVE_RESULT_UNEXPECTED + Rule conditions Scan File ${MESSAGE} Settings={symbols_enabled = [ANY_A]} Expect Symbol With Option ANY_A hello3 diff --git a/test/functional/configs/merged.conf b/test/functional/configs/merged.conf index bda7044e1..60930f657 100644 --- a/test/functional/configs/merged.conf +++ b/test/functional/configs/merged.conf @@ -8,6 +8,7 @@ lua = "{= env.TESTDIR =}/lua/hashes.lua" lua = "{= env.TESTDIR =}/lua/maps_kv.lua" lua = "{= env.TESTDIR =}/lua/option_order.lua" lua = "{= env.TESTDIR =}/lua/recipients.lua" +lua = "{= env.TESTDIR =}/lua/remove_result.lua" lua = "{= env.TESTDIR =}/lua/tlds.lua" # 104_get_from diff --git a/test/functional/lua/remove_result.lua b/test/functional/lua/remove_result.lua new file mode 100644 index 000000000..106d7f4cc --- /dev/null +++ b/test/functional/lua/remove_result.lua @@ -0,0 +1,26 @@ +local id = rspamd_config:register_symbol({ + name = 'REMOVE_RESULT_CB', + callback = function(task) + task:insert_result('REMOVE_RESULT_UNEXPECTED', 1.0, 'ohno') + end, + type = 'callback', +}) + +rspamd_config:register_symbol({ + name = 'REMOVE_RESULT_UNEXPECTED', + type = 'virtual', + score = 0.1, + group = 'remove_result_test', + parent = id, +}) + +rspamd_config:register_symbol({ + name = 'REMOVE_RESULT_EXPECTED', + callback = function(task) + return task:remove_result('REMOVE_RESULT_UNEXPECTED') and true or false + end, + type = 'normal', + score = 0.1, +}) + +rspamd_config:register_dependency('REMOVE_RESULT_EXPECTED', 'REMOVE_RESULT_UNEXPECTED') |