aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/310_udp.robot
blob: ee20d4ea55dd4654cc731256f56de88acf6904a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 Suite 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