aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/140_proxy.robot
blob: a2b872f51ef629360d1e3baed840458a6d46e668 (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 ***
${MESSAGE}            ${RSPAMD_TESTDIR}/messages/spam_message.eml
${RSPAMD_LUA_SCRIPT}  ${RSPAMD_TESTDIR}/lua/simple.lua
${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
  Rspamd Setup
  Set Suite Variable  ${SLAVE_PROCESS}  ${RSPAMD_PROCESS}
  Set Suite Variable  ${SLAVE_TMPDIR}  ${RSPAMD_TMPDIR}

  # Run proxy & copy variables
  Set Suite Variable  ${CONFIG}  ${RSPAMD_TESTDIR}/configs/proxy.conf
  Rspamd Setup  check_port=${RSPAMD_PORT_PROXY}
  Set Suite Variable  ${PROXY_PROCESS}  ${RSPAMD_PROCESS}
  Set Suite Variable  ${PROXY_TMPDIR}  ${RSPAMD_TMPDIR}

Proxy Teardown
  # Restore variables & run normal teardown
  Set Suite Variable  ${RSPAMD_PROCESS}  ${PROXY_PROCESS}
  Set Suite Variable  ${RSPAMD_TMPDIR}  ${PROXY_TMPDIR}
  Rspamd Teardown
  # Do it again for slave
  Set Suite Variable  ${RSPAMD_PROCESS}  ${SLAVE_PROCESS}
  Set Suite Variable  ${RSPAMD_TMPDIR}  ${SLAVE_TMPDIR}
  Rspamd Teardown