Debian Codegraph @

test/functional/cases/140_proxy.robot

raw
1 *** Settings ***
2 Suite Setup Proxy Setup
3 Suite Teardown Proxy Teardown
4 Library ${RSPAMD_TESTDIR}/lib/rspamd.py
5 Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot
6 Variables ${RSPAMD_TESTDIR}/lib/vars.py
7
8 *** Variables ***
9 ${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml
10 ${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/simple.lua
11 ${RSPAMD_SCOPE} Suite
12 ${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat
13
14 *** Test Cases ***
15 HTTP PROTOCOL
16 Set Test Variable ${RSPAMD_PORT_NORMAL} ${RSPAMD_PORT_PROXY}
17 Scan File ${MESSAGE}
18 Expect Symbol SIMPLE_TEST
19
20 SPAMC
21 ${result} = Spamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_PROXY} ${MESSAGE}
22 Should Contain ${result} SPAMD/1.1 0 EX_OK
23
24 RSPAMC Legacy Protocol
25 ${result} = Rspamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_PROXY} ${MESSAGE}
26 Should Contain ${result} RSPAMD/1.3 0 EX_OK
27
28 CHECKV3 VIA PROXY
29 [Documentation] Send /checkv3 multipart request through proxy, verify result
30 Set Test Variable ${RSPAMD_PORT_NORMAL} ${RSPAMD_PORT_PROXY}
31 Scan File V3 ${MESSAGE}
32 Expect Symbol SIMPLE_TEST
33
34 CHECKV3 VIA PROXY WITH COMPRESSION
35 [Documentation] Send /checkv3 via rspamc through proxy with zstd compression
36 ${result} = Run Rspamc -p -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_PROXY} --protocol-v3
37 ... ${MESSAGE}
38 Check Rspamc ${result} SIMPLE_TEST
39
40 *** Keywords ***
41 Proxy Setup
42 # Run slave & copy variables
43 Set Suite Variable ${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf
44 Rspamd Setup
45 Set Suite Variable ${SLAVE_PROCESS} ${RSPAMD_PROCESS}
46 Set Suite Variable ${SLAVE_TMPDIR} ${RSPAMD_TMPDIR}
47
48 # Run proxy & copy variables
49 Set Suite Variable ${CONFIG} ${RSPAMD_TESTDIR}/configs/proxy.conf
50 Rspamd Setup check_port=${RSPAMD_PORT_PROXY}
51 Set Suite Variable ${PROXY_PROCESS} ${RSPAMD_PROCESS}
52 Set Suite Variable ${PROXY_TMPDIR} ${RSPAMD_TMPDIR}
53
54 Proxy Teardown
55 # Restore variables & run normal teardown
56 Set Suite Variable ${RSPAMD_PROCESS} ${PROXY_PROCESS}
57 Set Suite Variable ${RSPAMD_TMPDIR} ${PROXY_TMPDIR}
58 Rspamd Teardown
59 # Do it again for slave
60 Set Suite Variable ${RSPAMD_PROCESS} ${SLAVE_PROCESS}
61 Set Suite Variable ${RSPAMD_TMPDIR} ${SLAVE_TMPDIR}
62 Rspamd Teardown