Debian Codegraph @

test/functional/lua/composites_postfilter.lua

raw
1 -- Test for composite with postfilter + filter symbols
2 -- This test demonstrates bug #5674
3
4 -- Normal filter symbol (executed during FILTERS stage)
5 rspamd_config:register_symbol({
6 type = 'normal',
7 name = 'TEST_FILTER_SYM',
8 callback = function(task)
9 task:insert_result('TEST_FILTER_SYM', 1.0)
10 end
11 })
12 rspamd_config:set_metric_symbol({
13 name = 'TEST_FILTER_SYM',
14 score = 1.0
15 })
16
17 -- Postfilter symbol (executed during POST_FILTERS stage)
18 rspamd_config:register_symbol({
19 type = 'postfilter',
20 name = 'TEST_POSTFILTER_SYM',
21 callback = function(task)
22 task:insert_result('TEST_POSTFILTER_SYM', 1.0)
23 end
24 })
25 rspamd_config:set_metric_symbol({
26 name = 'TEST_POSTFILTER_SYM',
27 score = 1.0
28 })
29
30 -- Composite is defined in merged-local.conf
31 -- TEST_POSTFILTER_COMPOSITE = TEST_FILTER_SYM & TEST_POSTFILTER_SYM
32 -- This should match when both symbols are present
33 -- BUG: Currently fails because composite is evaluated before postfilter runs
34 -- and is not re-evaluated in the second pass