diff options
author | Andrew Lewis <nerf@judo.za.org> | 2016-06-29 17:14:50 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2016-06-29 18:01:15 +0200 |
commit | 883800f3912a1a560c4393422e81aac6fa260a3e (patch) | |
tree | 778172f0a6e5966b20371ebf7ba5aef2abcdf63f /test | |
parent | 8c58447646bb27b357aed9c0f88db467dee233f3 (diff) | |
download | rspamd-883800f3912a1a560c4393422e81aac6fa260a3e.tar.gz rspamd-883800f3912a1a560c4393422e81aac6fa260a3e.zip |
[Test] Add generic rspamc result processor
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/cases/general.robot | 6 | ||||
-rw-r--r-- | test/functional/cases/lua.robot | 3 | ||||
-rw-r--r-- | test/functional/cases/statistics.robot | 48 | ||||
-rw-r--r-- | test/functional/lib/rspamd.robot | 10 |
4 files changed, 28 insertions, 39 deletions
diff --git a/test/functional/cases/general.robot b/test/functional/cases/general.robot index 4016b9a6a..aa146b4a9 100644 --- a/test/functional/cases/general.robot +++ b/test/functional/cases/general.robot @@ -13,13 +13,11 @@ ${RSPAMD_SCOPE} Suite *** Test Cases *** GTUBE ${result} = Scan Message With Rspamc ${GTUBE} - Follow Rspamd Log - Should Contain ${result.stdout} GTUBE ( + Check Rspamc ${result} GTUBE ( GTUBE - Encrypted ${result} = Run Rspamc -p -h ${LOCAL_ADDR}:${PORT_NORMAL} --key ${KEY_PUB1} ${GTUBE} - Follow Rspamd Log - Should Contain ${result.stdout} GTUBE ( + Check Rspamc ${result} GTUBE ( GTUBE - Scan File feature ${result} = Scan File ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE} diff --git a/test/functional/cases/lua.robot b/test/functional/cases/lua.robot index b8005cd8f..46dd15ea0 100644 --- a/test/functional/cases/lua.robot +++ b/test/functional/cases/lua.robot @@ -26,6 +26,5 @@ Flags Dependencies [Setup] Lua Setup ${TESTDIR}/lua/deps.lua ${result} = Scan Message With Rspamc ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} DEP10 + Check Rspamc ${result} DEP10 [Teardown] Generic Teardown diff --git a/test/functional/cases/statistics.robot b/test/functional/cases/statistics.robot index d9df49813..6d0218b56 100644 --- a/test/functional/cases/statistics.robot +++ b/test/functional/cases/statistics.robot @@ -21,21 +21,17 @@ Statistics Setup Sqlite Learn - Keyed, siphash [Setup] Statistics Setup @{ALIASES} STATS_BACKEND=sqlite3 STATS_HASH=siphash STATS_KEY=${KEY_PVT1} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE} - Should Contain ${result.stdout} success = true - Follow Rspamd Log + Check Rspamc ${result} ${result} = Scan Message With Rspamc ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} BAYES_SPAM + Check Rspamc ${result} BAYES_SPAM [Teardown] Generic Teardown Sqlite Learn - Keyed, xxhash [Setup] Statistics Setup @{ALIASES} STATS_BACKEND=sqlite3 STATS_HASH=xxh STATS_KEY=${KEY_PVT1} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} success = true + Check Rspamc ${result} ${result} = Scan Message With Rspamc ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} BAYES_SPAM + Check Rspamc ${result} BAYES_SPAM [Teardown] Generic Teardown Sqlite Learn - Broken Stats Directory @@ -49,51 +45,39 @@ Sqlite Learn - Empty part [Setup] Statistics Setup @{ALIASES} STATS_BACKEND=sqlite3 STATS_HASH=xxh STATS_KEY=${KEY_PVT1} Set Test Variable ${MESSAGE} ${TESTDIR}/messages/empty_part.eml ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} success = true + Check Rspamc ${result} ${result} = Scan Message With Rspamc ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} BAYES_SPAM + Check Rspamc ${result} BAYES_SPAM [Teardown] Generic Teardown Sqlite Relearn [Setup] Statistics Setup @{ALIASES} STATS_BACKEND=sqlite3 STATS_HASH=xxh STATS_KEY=${KEY_PVT1} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} success = true + Check Rspamc ${result} ${result} = Scan Message With Rspamc ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} BAYES_SPAM + Check Rspamc ${result} BAYES_SPAM ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_ham ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} success = true + Check Rspamc ${result} ${result} = Scan Message With Rspamc ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} BAYES_HAM + Check Rspamc ${result} BAYES_HAM [Teardown] Generic Teardown Mmap Learn [Setup] Statistics Setup @{ALIASES} STATS_BACKEND=mmap STATS_HASH=compat STATS_KEY=${KEY_PVT1} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} success = true + Check Rspamc ${result} ${result} = Scan Message With Rspamc ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} BAYES_SPAM + Check Rspamc ${result} BAYES_SPAM [Teardown] Generic Teardown Mmap Relearn [Setup] Statistics Setup @{ALIASES} STATS_BACKEND=mmap STATS_HASH=compat STATS_KEY=${KEY_PVT1} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} success = true + Check Rspamc ${result} ${result} = Scan Message With Rspamc ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} BAYES_SPAM + Check Rspamc ${result} BAYES_SPAM ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_ham ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} success = true + Check Rspamc ${result} ${result} = Scan Message With Rspamc ${MESSAGE} - Follow Rspamd Log - Should Contain ${result.stdout} BAYES_HAM + Check Rspamc ${result} BAYES_HAM [Teardown] Generic Teardown diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index a5ddca20e..b6180d40d 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -4,6 +4,15 @@ Library OperatingSystem Library Process *** Keywords *** +Check Rspamc + [Arguments] ${result} @{args} + ${arglen} = Get Length ${args} + ${expected_output} = Set Variable If ${arglen} < 1 success = true @{args}[0] + ${expected_rc} = Set Variable If ${arglen} < 2 0 @{args}[1] + Follow Rspamd Log + Should Contain ${result.stdout} ${expected_output} + Should Be Equal As Integers ${result.rc} ${expected_rc} + Export Rspamd Vars To Suite [Arguments] ${TMPDIR} ${RSPAMD_LOGPOS} ${RSPAMD_PID} Set Suite Variable ${TMPDIR} @@ -41,7 +50,6 @@ Log Logs Run Rspamc [Arguments] @{args} ${result} = Run Process ${RSPAMC} @{args} - Should Be Equal As Integers ${result.rc} 0 [Return] ${result} Run Rspamd |