diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-05 13:43:21 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-05 13:43:21 +0100 |
commit | 49fb6ed4d68e7691b5219c78fd0837ca4e2f7b94 (patch) | |
tree | 753f00b8f55b45596ef09a3eb7214cf518e58a2e /test/functional/cases | |
parent | 3db11dba2f19bef803f44d0e6b0e659d7d57088a (diff) | |
download | rspamd-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')
-rw-r--r-- | test/functional/cases/150_rspamadm.robot | 26 | ||||
-rw-r--r-- | test/functional/cases/151_rspamadm_async.robot | 36 |
2 files changed, 62 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 + diff --git a/test/functional/cases/151_rspamadm_async.robot b/test/functional/cases/151_rspamadm_async.robot new file mode 100644 index 000000000..ec97292dc --- /dev/null +++ b/test/functional/cases/151_rspamadm_async.robot @@ -0,0 +1,36 @@ +*** Settings *** +Test Setup Http Setup +Test Teardown Http 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 + + +*** Test Cases *** +Tcp client + ${result} = Run Process ${RSPAMADM} lua -b ${TESTDIR}/lua/rspamadm/test_tcp_client.lua + Should Match Regexp ${result.stderr} ^$ + Should Be Equal As Integers ${result.rc} 0 + Should Be Equal ${result.stdout} hello post + +*** Keywords *** + +Http Setup + Run Dummy Http + Run Redis + +Http Teardown + ${http_pid} = Get File /tmp/dummy_http.pid + Shutdown Process With Children ${http_pid} + Remove file /tmp/dummy_http.pid + Shutdown Process With Children ${REDIS_PID} + +Run Dummy Http + [Arguments] + ${result} = Start Process ${TESTDIR}/util/dummy_http.py + Wait Until Created /tmp/dummy_http.pid |