File: composites_postfilter.lua

package info (click to toggle)
rspamd 3.14.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 35,064 kB
  • sloc: ansic: 247,728; cpp: 107,741; javascript: 31,385; perl: 3,089; asm: 2,512; pascal: 1,625; python: 1,510; sh: 589; sql: 313; makefile: 195; xml: 74
file content (34 lines) | stat: -rw-r--r-- 997 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- Test for composite with postfilter + filter symbols
-- This test demonstrates bug #5674

-- Normal filter symbol (executed during FILTERS stage)
rspamd_config:register_symbol({
  type = 'normal',
  name = 'TEST_FILTER_SYM',
  callback = function(task)
    task:insert_result('TEST_FILTER_SYM', 1.0)
  end
})
rspamd_config:set_metric_symbol({
  name = 'TEST_FILTER_SYM',
  score = 1.0
})

-- Postfilter symbol (executed during POST_FILTERS stage)
rspamd_config:register_symbol({
  type = 'postfilter',
  name = 'TEST_POSTFILTER_SYM',
  callback = function(task)
    task:insert_result('TEST_POSTFILTER_SYM', 1.0)
  end
})
rspamd_config:set_metric_symbol({
  name = 'TEST_POSTFILTER_SYM',
  score = 1.0
})

-- Composite is defined in merged-local.conf
-- TEST_POSTFILTER_COMPOSITE = TEST_FILTER_SYM & TEST_POSTFILTER_SYM
-- This should match when both symbols are present
-- BUG: Currently fails because composite is evaluated before postfilter runs
-- and is not re-evaluated in the second pass