aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/140_proxy.robot
blob: 4dc2ad3461b3dc0b3fa8c6731c27b85f3ef0a03a (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
47
48
49
50
*** Settings ***
Suite Setup     Proxy Setup
Suite Teardown  Proxy Teardown
Library         ${RSPAMD_TESTDIR}/lib/rspamd.py
Resource        ${RSPAMD_TESTDIR}/lib/rspamd.robot
Variables       ${RSPAMD_TESTDIR}/lib/vars.py

*** Variables ***
${RSPAMD_LUA_SCRIPT}    ${RSPAMD_TESTDIR}/lua/simple.lua
${MESSAGE}       ${RSPAMD_TESTDIR}/messages/spam_message.eml
${RSPAMD_SCOPE}  Suite
${RSPAMD_URL_TLD}       ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat

*** Test Cases ***
HTTP PROTOCOL
  Set Test Variable  ${RSPAMD_PORT_NORMAL}  ${RSPAMD_PORT_PROXY}
  Scan File  ${MESSAGE}
  Expect Symbol  SIMPLE_TEST

SPAMC
  ${result} =  Spamc  ${RSPAMD_LOCAL_ADDR}  ${RSPAMD_PORT_PROXY}  ${MESSAGE}
  Should Contain  ${result}  SPAMD/1.1 0 EX_OK

RSPAMC Legacy Protocol
  ${result} =  Rspamc  ${RSPAMD_LOCAL_ADDR}  ${RSPAMD_PORT_PROXY}  ${MESSAGE}
  Should Contain  ${result}  RSPAMD/1.3 0 EX_OK

*** Keywords ***
Proxy Setup
  # Run slave & copy variables
  Set Suite Variable  ${CONFIG}  ${RSPAMD_TESTDIR}/configs/lua_test.conf
  New Setup
  Set Suite Variable  ${SLAVE_PID}  ${RSPAMD_PID}
  Set Suite Variable  ${SLAVE_TMPDIR}  ${RSPAMD_TMPDIR}

  # Run proxy & copy variables
  Set Suite Variable  ${CONFIG}  ${RSPAMD_TESTDIR}/configs/proxy.conf
  New Setup
  Set Suite Variable  ${PROXY_PID}  ${RSPAMD_PID}
  Set Suite Variable  ${PROXY_TMPDIR}  ${RSPAMD_TMPDIR}

Proxy Teardown
  # Restore variables & run normal teardown
  Set Suite Variable  ${RSPAMD_PID}  ${PROXY_PID}
  Set Suite Variable  ${RSPAMD_TMPDIR}  ${PROXY_TMPDIR}
  Normal Teardown
  # Do it again for slave
  Set Suite Variable  ${RSPAMD_PID}  ${SLAVE_PID}
  Set Suite Variable  ${RSPAMD_TMPDIR}  ${SLAVE_TMPDIR}
  Normal Teardown