summaryrefslogtreecommitdiffstats
path: root/test/functional/cases/140_proxy.robot
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2016-08-09 13:58:33 +0100
committerAndrew Lewis <nerf@judo.za.org>2016-08-09 13:58:33 +0100
commitbd01177c1364399ef29ca6671669a271af967998 (patch)
tree1cd23721c7ab3c95afde01d3b4007078e208133c /test/functional/cases/140_proxy.robot
parent8e2d181f6df9533a2cbb02e6dffaca21647ea14e (diff)
downloadrspamd-bd01177c1364399ef29ca6671669a271af967998.tar.gz
rspamd-bd01177c1364399ef29ca6671669a271af967998.zip
[Test] Add simple test for proxying
Diffstat (limited to 'test/functional/cases/140_proxy.robot')
-rw-r--r--test/functional/cases/140_proxy.robot38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/functional/cases/140_proxy.robot b/test/functional/cases/140_proxy.robot
new file mode 100644
index 000000000..6ad308692
--- /dev/null
+++ b/test/functional/cases/140_proxy.robot
@@ -0,0 +1,38 @@
+*** Settings ***
+Suite Setup Proxy Setup
+Suite Teardown Proxy Teardown
+Library ${TESTDIR}/lib/rspamd.py
+Resource ${TESTDIR}/lib/rspamd.robot
+Variables ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${LUA_SCRIPT} ${TESTDIR}/lua/simple.lua
+${MESSAGE} ${TESTDIR}/messages/spam_message.eml
+
+*** Test Cases ***
+Scan Message
+ ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_PROXY} -p ${MESSAGE}
+ ${PROXY_LOGPOS} = Log Logs ${PROXY_TMPDIR}/rspamd.log ${PROXY_LOGPOS}
+ Set Suite Variable ${PROXY_LOGPOS}
+ ${SLAVE_LOGPOS} = Log Logs ${SLAVE_TMPDIR}/rspamd.log ${SLAVE_LOGPOS}
+ Set Suite Variable ${SLAVE_LOGPOS}
+ Run Keyword If ${result.rc} != 0 Log ${result.stderr}
+ Should Contain ${result.stdout} SIMPLE_TEST
+ Should Be Equal As Integers ${result.rc} 0
+
+*** Keywords ***
+Proxy Setup
+ &{d} = Run Rspamd CONFIG=${TESTDIR}/configs/lua_test.conf
+ Set Suite Variable ${SLAVE_LOGPOS} &{d}[RSPAMD_LOGPOS]
+ Set Suite Variable ${SLAVE_PID} &{d}[RSPAMD_PID]
+ Set Suite Variable ${SLAVE_TMPDIR} &{d}[TMPDIR]
+ &{d} = Run Rspamd CONFIG=${TESTDIR}/configs/proxy.conf
+ Set Suite Variable ${PROXY_LOGPOS} &{d}[RSPAMD_LOGPOS]
+ Set Suite Variable ${PROXY_PID} &{d}[RSPAMD_PID]
+ Set Suite Variable ${PROXY_TMPDIR} &{d}[TMPDIR]
+
+Proxy Teardown
+ Shutdown Process With Children ${PROXY_PID}
+ Shutdown Process With Children ${SLAVE_PID}
+ Cleanup Temporary Directory ${PROXY_TMPDIR}
+ Cleanup Temporary Directory ${SLAVE_TMPDIR}