Debian Codegraph @

test/functional/cases/500_ratelimit.robot

raw
1 *** Settings ***
2 Suite Setup Rspamd Redis Setup
3 Suite Teardown Rspamd Redis Teardown
4 Library ${RSPAMD_TESTDIR}/lib/rspamd.py
5 Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot
6 Variables ${RSPAMD_TESTDIR}/lib/vars.py
7
8 *** Variables ***
9 ${CONFIG} ${RSPAMD_TESTDIR}/configs/ratelimit.conf
10 ${MESSAGE} ${RSPAMD_TESTDIR}/messages/zip.eml
11 ${REDIS_SCOPE} Suite
12 ${RSPAMD_SCOPE} Suite
13 ${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat
14 ${SETTINGS_RATELIMIT} {symbols_enabled = [RATELIMIT_CHECK, RATELIMIT_UPDATE]}
15
16 *** Keywords ***
17 Basic Test Scan
18 [Arguments] ${from} ${rcpt}
19 Scan File ${MESSAGE}
20 ... From=${from}
21 ... IP=1.1.1.1
22 ... Settings=${SETTINGS_RATELIMIT}
23 ... Rcpt=${rcpt}
24
25 Basic Test
26 [Arguments] ${from} ${rcpt} ${howmany}
27 # Should be able to send up to burst
28 FOR ${index} IN RANGE ${howmany}
29 Basic Test Scan ${from} ${rcpt}
30 Expect Action no action
31 END
32 # Should then be ratelimited
33 Basic Test Scan ${from} ${rcpt}
34 Expect Action soft reject
35 # Should be able to send 1 message 1 second later
36 Sleep 1s
37 Basic Test Scan ${from} ${rcpt}
38 Expect Action no action
39 # Ratelimited again
40 Basic Test Scan ${from} ${rcpt}
41 Expect Action soft reject
42
43 *** Test Cases ***
44 RATELIMIT CHECK BUILTIN
45 Basic Test ${EMPTY} [email protected] 4
46
47 RATELIMIT CHECK SELECTOR
48 Basic Test [email protected] [email protected] 2