commit 2964a12: [Test] Add some classifiers to settings tests

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jun 10 17:14:10 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-06-10 13:41:56 +0100
URL: https://github.com/rspamd/rspamd/commit/2964a12af4346da027f3d4800b8f12391120e89f

[Test] Add some classifiers to settings tests

---
 conf/statistic.conf                      |  1 -
 test/functional/cases/108_settings.robot | 14 ++++++++++++--
 test/functional/configs/settings.conf    | 15 +++++++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/conf/statistic.conf b/conf/statistic.conf
index d2b5b147a..8d45e7608 100644
--- a/conf/statistic.conf
+++ b/conf/statistic.conf
@@ -24,7 +24,6 @@ classifier "bayes" {
     name = "osb";
   }
   cache {
-    path = "${DBDIR}/learn_cache.sqlite";
   }
   new_schema = true; # Always use new schema
   store_tokens = false; # Redefine if storing of tokens is desired
diff --git a/test/functional/cases/108_settings.robot b/test/functional/cases/108_settings.robot
index 44d9b8b4d..9011ad7b3 100644
--- a/test/functional/cases/108_settings.robot
+++ b/test/functional/cases/108_settings.robot
@@ -9,15 +9,25 @@ Variables       ${TESTDIR}/lib/vars.py
 ${CONFIG}       ${TESTDIR}/configs/plugins.conf
 ${LUA_SCRIPT}   ${TESTDIR}/lua/settings.lua
 ${MESSAGE}      ${TESTDIR}/messages/spam_message.eml
+${SPAM_MESSAGE}      ${TESTDIR}/messages/spam.eml
+${HAM_MESSAGE}      ${TESTDIR}/messages/ham.eml
 ${RSPAMD_SCOPE}  Suite
 ${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat
 
 *** Test Cases ***
-NO SETTINGS
-  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+NO SETTINGS SPAM
+  ${result} =  Scan Message With Rspamc  ${SPAM_MESSAGE}
   Check Rspamc  ${result}  SIMPLE_TEST
   Should Contain  ${result.stdout}  SIMPLE_PRE
   Should Contain  ${result.stdout}  SIMPLE_POST
+  Should Contain  ${result.stdout}  BAYES_SPAM
+
+NO SETTINGS HAM
+  ${result} =  Scan Message With Rspamc  ${HAM_MESSAGE}
+  Check Rspamc  ${result}  SIMPLE_TEST
+  Should Contain  ${result.stdout}  SIMPLE_PRE
+  Should Contain  ${result.stdout}  SIMPLE_POST
+  Should Contain  ${result.stdout}  BAYES_HAM
 
 ENABLE SYMBOL - NORMAL
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={symbols_enabled = ["SIMPLE_TEST"]}
diff --git a/test/functional/configs/settings.conf b/test/functional/configs/settings.conf
index c2b4ba6cc..091eb5f2c 100644
--- a/test/functional/configs/settings.conf
+++ b/test/functional/configs/settings.conf
@@ -14,3 +14,18 @@ settings {
     }
   }
 }
+classifier {
+  backend = "sqlite3";
+  statfile {
+    spam = true;
+    symbol = BAYES_SPAM;
+    path = "${TESTDIR}/data/bayes.spam.sqlite3";
+  }
+  statfile {
+    spam = false;
+    symbol = BAYES_HAM;
+    path = "${TESTDIR}/data/bayes.ham.sqlite3";
+  }
+  min_learns = 1;
+  min_token_hits = 1;
+}
\ No newline at end of file


More information about the Commits mailing list