commit 7dc7937: [Test] Fix statistics tests

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Jul 10 12:14:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-07-10 13:11:19 +0100
URL: https://github.com/rspamd/rspamd/commit/7dc7937cee6c3a0b332c37e31e5ce827df893ed2 (HEAD -> master)

[Test] Fix statistics tests

---
 test/functional/cases/110_statistics/lib.robot | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/test/functional/cases/110_statistics/lib.robot b/test/functional/cases/110_statistics/lib.robot
index 619f355d0..c20c0f651 100644
--- a/test/functional/cases/110_statistics/lib.robot
+++ b/test/functional/cases/110_statistics/lib.robot
@@ -5,7 +5,8 @@ Variables       ${TESTDIR}/lib/vars.py
 
 *** Variables ***
 ${CONFIG}       ${TESTDIR}/configs/stats.conf
-${MESSAGE}      ${TESTDIR}/messages/spam_message.eml
+${MESSAGE_SPAM}      ${TESTDIR}/messages/spam_message.eml
+${MESSAGE_HAM}      ${TESTDIR}/messages/ham.eml
 ${REDIS_SCOPE}  Suite
 ${REDIS_SERVER}  ${EMPTY}
 ${RSPAMD_SCOPE}  Suite
@@ -14,7 +15,7 @@ ${STATS_KEY}    ${EMPTY}
 
 *** Keywords ***
 Broken Learn Test
-  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_spam  ${MESSAGE}
+  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_spam  ${MESSAGE_SPAM}
   Check Rspamc  ${result}  Unknown statistics error
 
 Empty Part Test
@@ -26,17 +27,20 @@ Empty Part Test
 
 Learn Test
   Set Suite Variable  ${RSPAMD_STATS_LEARNTEST}  0
-  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_spam  ${MESSAGE}
+  ${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}
-  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  ${result} =  Scan Message With Rspamc  ${MESSAGE_SPAM}
   Check Rspamc  ${result}  BAYES_SPAM
+  ${result} =  Scan Message With Rspamc  ${MESSAGE_HAM}
+  Check Rspamc  ${result}  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}
+  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_ham  ${MESSAGE_SPAM}
   Check Rspamc  ${result}
-  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  ${result} =  Scan Message With Rspamc  ${MESSAGE_SPAM}
   ${pass} =  Run Keyword And Return Status  Check Rspamc  ${result}  BAYES_HAM
   Run Keyword If  ${pass}  Pass Execution  What Me Worry
   Should Not Contain  ${result.stdout}  BAYES_SPAM


More information about the Commits mailing list