blob: 808580a114dfc540bc3cb46e60b413977e73b1ac (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
*** Settings ***
Library ${TESTDIR}/lib/rspamd.py
Resource ${TESTDIR}/lib/rspamd.robot
Variables ${TESTDIR}/lib/vars.py
*** Variables ***
${CONFIG} ${TESTDIR}/configs/stats.conf
${MESSAGE_SPAM} ${TESTDIR}/messages/spam_message.eml
${MESSAGE_HAM} ${TESTDIR}/messages/ham.eml
${REDIS_SCOPE} Suite
${REDIS_SERVER} null
${RSPAMD_SCOPE} Suite
${STATS_BACKEND} redis
${STATS_HASH} null
${STATS_KEY} null
*** Keywords ***
Broken Learn Test
${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE_SPAM}
Check Rspamc ${result} Unknown statistics error
Empty Part Test
Set Test Variable ${MESSAGE} ${TESTDIR}/messages/empty_part.eml
${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE}
Check Rspamc ${result}
Scan File ${MESSAGE}
Expect Symbol BAYES_SPAM
Learn Test
Set Suite Variable ${RSPAMD_STATS_LEARNTEST} 0
${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE_SPAM}
${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_ham ${MESSAGE_HAM}
Check Rspamc ${result}
Scan File ${MESSAGE_SPAM}
Expect Symbol BAYES_SPAM
Scan File ${MESSAGE_HAM}
Expect Symbol BAYES_HAM
Set Suite Variable ${RSPAMD_STATS_LEARNTEST} 1
Relearn Test
Run Keyword If ${RSPAMD_STATS_LEARNTEST} == 0 Fail "Learn test was not run"
${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_ham ${MESSAGE_SPAM}
Check Rspamc ${result}
Scan File ${MESSAGE_SPAM}
${pass} = Run Keyword And Return Status Expect Symbol BAYES_HAM
Run Keyword If ${pass} Pass Execution What Me Worry
Do Not Expect Symbol BAYES_SPAM
Redis Statistics Setup
Run Redis
New Setup STATS_BACKEND=${STATS_BACKEND} STATS_HASH=${STATS_HASH} STATS_KEY=${STATS_KEY} REDIS_SERVER=${REDIS_SERVER}
Redis Statistics Teardown
Normal Teardown
|