diff options
author | Andrew Lewis <nerf@judo.za.org> | 2024-07-10 14:46:34 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2024-07-10 14:46:34 +0200 |
commit | bf66ae7777fb8d087fe37c0052bdca1b724cb0a1 (patch) | |
tree | 1bcf2ca4a412a7eb7a9640a1284b8298d4b9e4aa /test/functional/cases | |
parent | 7627666d9efbac9b58d2396f281acb9879000a3c (diff) | |
download | rspamd-bf66ae7777fb8d087fe37c0052bdca1b724cb0a1.tar.gz rspamd-bf66ae7777fb8d087fe37c0052bdca1b724cb0a1.zip |
[Test] Add tests for ratelimit module
Diffstat (limited to 'test/functional/cases')
-rw-r--r-- | test/functional/cases/500_ratelimit.conf | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/functional/cases/500_ratelimit.conf b/test/functional/cases/500_ratelimit.conf new file mode 100644 index 000000000..425df34be --- /dev/null +++ b/test/functional/cases/500_ratelimit.conf @@ -0,0 +1,44 @@ +*** Settings *** +Suite Setup Rspamd Setup +Suite Teardown Rspamd Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${CONFIG} ${RSPAMD_TESTDIR}/configs/ratelimit.conf +${MESSAGE} ${RSPAMD_TESTDIR}/messages/ham.eml +${RSPAMD_SCOPE} Suite +${SETTINGS_REPLIES} {symbols_enabled = [RATELIMIT_CHECK, RATELIMIT_UPDATE]} + +*** Keywords *** +Recipient Test + [Arguments] ${from} ${rcpt} ${howmany} + FOR ${index} IN RANGE ${howmany} + Scan File ${HAM_MESSAGE} + ... From=${from} + ... IP=1.1.1.1 + ... Settings=${SETTINGS_RATELIMIT} + ... Rcpt=${rcpt} + Expect Action no action + END + Scan File ${HAM_MESSAGE} + ... From=${from} + ... IP=1.1.1.1 + ... Settings=${SETTINGS_RATELIMIT} + ... Rcpt=${rcpt} + Expect Action soft reject + Sleep 1s + Scan File ${HAM_MESSAGE} + ... From=${from} + ... IP=1.1.1.1 + ... Settings=${SETTINGS_RATELIMIT} + ... Rcpt=${rcpt} + Expect Action no action + +*** Test Cases *** +CHECK BASIC + Recipient Test ${EMPTY} foobar@example.net 4 + +CHECK SELECTOR + Recipient Test foo@example.net special@example.net 2 |