aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/240_redis.robot
blob: 70798a96bb8982b98c449203b1eaa8b3967bca5f (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
*** Settings ***
Test Setup      Redis Setup
Test Teardown   Redis Teardown
Library         Process
Library         ${TESTDIR}/lib/rspamd.py
Resource        ${TESTDIR}/lib/rspamd.robot
Variables       ${TESTDIR}/lib/vars.py
Suite Teardown  Terminate All Processes    kill=True


*** Variables ***
${REDIS_SCOPE}  Test
${RSPAMD_SCOPE}  Test
${CONFIG}       ${TESTDIR}/configs/plugins.conf
${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat
${MESSAGE}      ${TESTDIR}/messages/spam_message.eml


*** Test Cases ***
Redis client
  Redis SET  test_key  test value
  ${result} =  Scan Message With Rspamc  ${MESSAGE}
  Check Rspamc  ${result}  REDIS (0.00)[hello from lua on redis]
  Check Rspamc  ${result}  REDIS_ASYNC (0.00)[test value]

*** Keywords ***
Lua Setup
  [Arguments]  ${LUA_SCRIPT}
  Set Global Variable  ${LUA_SCRIPT}
  ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/redis.conf
  Set Suite Variable  ${PLUGIN_CONFIG}
  Generic Setup  PLUGIN_CONFIG

Redis Setup
  Lua Setup  ${TESTDIR}/lua/redis.lua
  Run Redis

Redis Teardown
  Normal Teardown
  Shutdown Process With Children  ${REDIS_PID}