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
[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
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}
Run Rspamc
[Arguments] @{args}
${result} = Run Process ${RSPAMC} @{args}
- Should Be Equal As Integers ${result.rc} 0
[Return] ${result}
Run Rspamd