aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/310_udp.robot
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-21 17:04:05 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-21 17:04:05 +0000
commit6f72e868f5217c0cb7373546a1d6337d5f1494f3 (patch)
tree786f4e0c795603853e4c70ad62dae6953223be4a /test/functional/cases/310_udp.robot
parentb6b05333337350a9ad9936f1443048e7bd3a56fc (diff)
downloadrspamd-6f72e868f5217c0cb7373546a1d6337d5f1494f3.tar.gz
rspamd-6f72e868f5217c0cb7373546a1d6337d5f1494f3.zip
[Test] Add tests for lua_udp
Diffstat (limited to 'test/functional/cases/310_udp.robot')
-rw-r--r--test/functional/cases/310_udp.robot46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/functional/cases/310_udp.robot b/test/functional/cases/310_udp.robot
new file mode 100644
index 000000000..2ecd1cfb8
--- /dev/null
+++ b/test/functional/cases/310_udp.robot
@@ -0,0 +1,46 @@
+*** Settings ***
+Test Setup UDP Setup
+Test Teardown UDP Teardown
+Library Process
+Library ${TESTDIR}/lib/rspamd.py
+Resource ${TESTDIR}/lib/rspamd.robot
+Variables ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
+${CONFIG} ${TESTDIR}/configs/lua_test.conf
+${MESSAGE} ${TESTDIR}/messages/spam_message.eml
+${RSPAMD_SCOPE} Test
+
+*** Test Cases ***
+Simple UDP request
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} UDP_SUCCESS (0.00)[helloworld]
+
+Sendonly UDP request
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} UDP_SENDTO
+
+Errored UDP request
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} UDP_FAIL (0.00)[read timeout]
+
+*** Keywords ***
+Lua Setup
+ [Arguments] ${LUA_SCRIPT}
+ Set Global Variable ${LUA_SCRIPT}
+ Generic Setup
+
+UDP Setup
+ Run Dummy UDP
+ Lua Setup ${TESTDIR}/lua/udp.lua
+
+UDP Teardown
+ ${udp_pid} = Get File /tmp/dummy_udp.pid
+ Shutdown Process With Children ${udp_pid}
+ Normal Teardown
+
+Run Dummy UDP
+ [Arguments]
+ ${result} = Start Process ${TESTDIR}/util/dummy_udp.py 5005
+ Wait Until Created /tmp/dummy_udp.pid