aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/150_rspamadm.robot
diff options
context:
space:
mode:
authorMikhail Galanin <mgalanin@mimecast.com>2018-09-05 13:43:21 +0100
committerMikhail Galanin <mgalanin@mimecast.com>2018-09-05 13:43:21 +0100
commit49fb6ed4d68e7691b5219c78fd0837ca4e2f7b94 (patch)
tree753f00b8f55b45596ef09a3eb7214cf518e58a2e /test/functional/cases/150_rspamadm.robot
parent3db11dba2f19bef803f44d0e6b0e659d7d57088a (diff)
downloadrspamd-49fb6ed4d68e7691b5219c78fd0837ca4e2f7b94.tar.gz
rspamd-49fb6ed4d68e7691b5219c78fd0837ca4e2f7b94.zip
[Test] Added more test for rspamadm and test for lua tcp client invoked via rspamadm
Diffstat (limited to 'test/functional/cases/150_rspamadm.robot')
-rw-r--r--test/functional/cases/150_rspamadm.robot26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/functional/cases/150_rspamadm.robot b/test/functional/cases/150_rspamadm.robot
index 4e7b3c8aa..82532ddab 100644
--- a/test/functional/cases/150_rspamadm.robot
+++ b/test/functional/cases/150_rspamadm.robot
@@ -1,5 +1,8 @@
*** Settings ***
Library Process
+Library ../lib/rspamd.py
+
+Suite Teardown Terminate All Processes kill=True
*** Test Cases ***
Config Test
@@ -12,3 +15,26 @@ Config Help
${result} = Run Process ${RSPAMADM} confighelp
Should Match Regexp ${result.stderr} ^$
Should Be Equal As Integers ${result.rc} 0
+
+Simple interpreter
+ ${handle} = Start Process ${RSPAMADM} lua
+ ${result} = Write to stdin ${handle} 1+1
+ Should Be Equal As Strings ${result} 2\n
+
+Simple interpreter, two results
+ ${handle} = Start Process ${RSPAMADM} lua
+ ${result} = Write to stdin ${handle} 1+1, 2 * 5
+ Should Be Equal ${result} 2\n10\n
+
+Process message callback
+ ${handle} = Start Process ${RSPAMADM} lua
+ ${result} = Write to stdin ${handle} .load ${TESTDIR}/lua/rspamadm/test_message_callback.lua\n.message message_callback ${TESTDIR}/messages/empty_part.eml
+ Should Contain ${result} n parts = 2
+ Should Contain ${result} 1\n2\n4\n6
+
+Lua batch mode
+ ${result} = Run Process ${RSPAMADM} lua -b ${TESTDIR}/lua/rspamadm/test_batch.lua
+ Should Match Regexp ${result.stderr} ^$
+ Should Be Equal As Integers ${result.rc} 0
+ Should Be Equal ${result.stdout} hello world
+