commit 450314b: [Test] Add some tests for greylist module

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Dec 27 18:28:04 UTC 2018


Author: Vsevolod Stakhov
Date: 2018-12-08 09:47:27 +0000
URL: https://github.com/rspamd/rspamd/commit/450314bcaeb463a6de6358e33d84be30301cc8a2

[Test] Add some tests for greylist module

---
 test/functional/cases/290_greylist.robot | 39 ++++++++++++++++++++++++++++++++
 test/functional/configs/greylist.conf    | 11 +++++++++
 2 files changed, 50 insertions(+)

diff --git a/test/functional/cases/290_greylist.robot b/test/functional/cases/290_greylist.robot
new file mode 100644
index 000000000..64896fe2b
--- /dev/null
+++ b/test/functional/cases/290_greylist.robot
@@ -0,0 +1,39 @@
+*** Settings ***
+Suite Setup     Greylist Setup
+Suite Teardown  Greylist Teardown
+Library         ${TESTDIR}/lib/rspamd.py
+Resource        ${TESTDIR}/lib/rspamd.robot
+Variables       ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${CONFIG}       ${TESTDIR}/configs/plugins.conf
+${MESSAGE}      ${TESTDIR}/messages/spam_message.eml
+${REDIS_SCOPE}  Suite
+${RSPAMD_SCOPE}  Suite
+${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat
+
+*** Test Cases ***
+GREYLIST NEW
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  Check Rspamc  ${result}  GREYLIST (0.00)[greylisted
+
+GREYLIST EARLY
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  Check Rspamc  ${result}  GREYLIST (0.00)[greylisted
+
+GREYLIST PASS
+  Sleep  4s  Wait greylisting timeout
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  Check Rspamc  ${result}  GREYLIST (0.00)[pass
+
+*** Keywords ***
+Greylist Setup
+  ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/greylist.conf
+  Set Suite Variable  ${PLUGIN_CONFIG}
+  Generic Setup  PLUGIN_CONFIG
+  Run Redis
+
+Greylist Teardown
+  Normal Teardown
+  Shutdown Process With Children  ${REDIS_PID}
+  Terminate All Processes    kill=True
\ No newline at end of file
diff --git a/test/functional/configs/greylist.conf b/test/functional/configs/greylist.conf
new file mode 100644
index 000000000..5e12accf9
--- /dev/null
+++ b/test/functional/configs/greylist.conf
@@ -0,0 +1,11 @@
+redis {
+  servers = "${REDIS_ADDR}:${REDIS_PORT}";
+}
+greylist {
+  check_local = true;
+  timeout = 4;
+}
+
+actions {
+  greylist = 1;
+}


More information about the Commits mailing list