]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Test dkim_signing with redis
authorAndrew Lewis <nerf@judo.za.org>
Tue, 9 May 2017 10:40:33 +0000 (12:40 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Sun, 28 May 2017 14:00:56 +0000 (16:00 +0200)
test/functional/cases/131_dkim_signing.robot [deleted file]
test/functional/cases/131_dkim_signing/001_simple.robot [new file with mode: 0644]
test/functional/cases/131_dkim_signing/002_redis.robot [new file with mode: 0644]
test/functional/configs/dkim_signing.conf [deleted file]
test/functional/configs/dkim_signing/redis.conf [new file with mode: 0644]
test/functional/configs/dkim_signing/simple.conf [new file with mode: 0644]

diff --git a/test/functional/cases/131_dkim_signing.robot b/test/functional/cases/131_dkim_signing.robot
deleted file mode 100644 (file)
index 58f608b..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-*** Settings ***
-Suite Setup     DKIM Signing Setup
-Suite Teardown  DKIM Signing 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/dmarc/fail_none.eml
-${REDIS_SCOPE}  Suite
-${RSPAMD_SCOPE}  Suite
-${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat
-
-*** Test Cases ***
-TEST SIGNED
-  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -u  bob@rspamd.tk
-  Check Rspamc  ${result}  DKIM-Signature:
-  Should Contain  ${result.stdout}  DKIM_SIGNED (1.00)
-
-TEST NOT SIGNED - USERNAME WRONG DOMAIN
-  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -u  bob@example.tk
-  Check Rspamc  ${result}  DKIM-Signature:  inverse=1
-  Should Not Contain  ${result.stdout}  DKIM_SIGNED (1.00)
-
-*** Keywords ***
-DKIM Signing Setup
-  ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/dkim_signing.conf
-  Set Suite Variable  ${PLUGIN_CONFIG}
-  Generic Setup  PLUGIN_CONFIG
-
-DKIM Signing Teardown
-  Normal Teardown
diff --git a/test/functional/cases/131_dkim_signing/001_simple.robot b/test/functional/cases/131_dkim_signing/001_simple.robot
new file mode 100644 (file)
index 0000000..c715b47
--- /dev/null
@@ -0,0 +1,33 @@
+*** Settings ***
+Suite Setup     DKIM Signing Setup
+Suite Teardown  DKIM Signing 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/dmarc/fail_none.eml
+${REDIS_SCOPE}  Suite
+${RSPAMD_SCOPE}  Suite
+${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat
+
+*** Test Cases ***
+TEST SIGNED
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -u  bob@rspamd.tk
+  Check Rspamc  ${result}  DKIM-Signature:
+  Should Contain  ${result.stdout}  DKIM_SIGNED (1.00)
+
+TEST NOT SIGNED - USERNAME WRONG DOMAIN
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -u  bob@example.tk
+  Check Rspamc  ${result}  DKIM-Signature:  inverse=1
+  Should Not Contain  ${result.stdout}  DKIM_SIGNED (1.00)
+
+*** Keywords ***
+DKIM Signing Setup
+  ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/dkim_signing/simple.conf
+  Set Suite Variable  ${PLUGIN_CONFIG}
+  Generic Setup  PLUGIN_CONFIG
+
+DKIM Signing Teardown
+  Normal Teardown
diff --git a/test/functional/cases/131_dkim_signing/002_redis.robot b/test/functional/cases/131_dkim_signing/002_redis.robot
new file mode 100644 (file)
index 0000000..f46bfbc
--- /dev/null
@@ -0,0 +1,39 @@
+*** Settings ***
+Suite Setup     DKIM Signing Setup
+Suite Teardown  DKIM Signing 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/dmarc/fail_none.eml
+${REDIS_SCOPE}  Suite
+${RSPAMD_SCOPE}  Suite
+${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat
+
+*** Test Cases ***
+TEST SIGNED
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -u  bob@rspamd.tk
+  Check Rspamc  ${result}  DKIM-Signature:
+  Should Contain  ${result.stdout}  DKIM_SIGNED (1.00)
+
+TEST NOT SIGNED - USERNAME WRONG DOMAIN
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -u  bob@example.tk
+  Check Rspamc  ${result}  DKIM-Signature:  inverse=1
+  Should Not Contain  ${result.stdout}  DKIM_SIGNED (1.00)
+
+*** Keywords ***
+DKIM Signing Setup
+  ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/dkim_signing/redis.conf
+  Set Suite Variable  ${PLUGIN_CONFIG}
+  Generic Setup  PLUGIN_CONFIG
+  Run Redis
+  Redis HSET  TEST_DKIM_SELECTORS  rspamd.tk  test
+  ${key} =  Get File  ${TESTDIR}/configs/dkim.key
+  Redis HSET  TEST_DKIM_KEYS  test.rspamd.tk  ${key}
+
+DKIM Signing Teardown
+  Normal Teardown
+  Shutdown Process With Children  ${REDIS_PID}
+  Wait For Port  ${SOCK_STREAM}  ${LOCAL_ADDR}  ${REDIS_PORT}
diff --git a/test/functional/configs/dkim_signing.conf b/test/functional/configs/dkim_signing.conf
deleted file mode 100644 (file)
index d233bef..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-dkim_signing {
-  path = "${TESTDIR}/configs/dkim.key";
-}
diff --git a/test/functional/configs/dkim_signing/redis.conf b/test/functional/configs/dkim_signing/redis.conf
new file mode 100644 (file)
index 0000000..903a13c
--- /dev/null
@@ -0,0 +1,8 @@
+dkim_signing {
+  use_redis = true;
+  key_prefix = "TEST_DKIM_KEYS";
+  selector_prefix = "TEST_DKIM_SELECTORS";
+}
+redis {
+  servers = "${REDIS_ADDR}:${REDIS_PORT}";
+}
diff --git a/test/functional/configs/dkim_signing/simple.conf b/test/functional/configs/dkim_signing/simple.conf
new file mode 100644 (file)
index 0000000..d233bef
--- /dev/null
@@ -0,0 +1,3 @@
+dkim_signing {
+  path = "${TESTDIR}/configs/dkim.key";
+}