summaryrefslogtreecommitdiffstats
path: root/test/functional/cases/110_statistics
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/cases/110_statistics')
-rw-r--r--test/functional/cases/110_statistics/compat-keyed.robot20
-rw-r--r--test/functional/cases/110_statistics/compat-plain.robot19
-rw-r--r--test/functional/cases/110_statistics/lib.robot57
-rw-r--r--test/functional/cases/110_statistics/redis-keyed-siphash.robot20
-rw-r--r--test/functional/cases/110_statistics/redis-keyed-xxhash.robot20
-rw-r--r--test/functional/cases/110_statistics/redis-plain-siphash.robot19
-rw-r--r--test/functional/cases/110_statistics/redis-plain-xxhash.robot19
-rw-r--r--test/functional/cases/110_statistics/sqlite-broken-stats-dir.robot15
-rw-r--r--test/functional/cases/110_statistics/sqlite-keyed-siphash.robot19
-rw-r--r--test/functional/cases/110_statistics/sqlite-keyed-xxhash.robot19
-rw-r--r--test/functional/cases/110_statistics/sqlite-plain-siphash.robot18
-rw-r--r--test/functional/cases/110_statistics/sqlite-plain-xxhash.robot18
12 files changed, 263 insertions, 0 deletions
diff --git a/test/functional/cases/110_statistics/compat-keyed.robot b/test/functional/cases/110_statistics/compat-keyed.robot
new file mode 100644
index 000000000..1242df12c
--- /dev/null
+++ b/test/functional/cases/110_statistics/compat-keyed.robot
@@ -0,0 +1,20 @@
+*** Settings ***
+Suite Setup Statistics Setup
+Suite Teardown Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${STATS_BACKEND} mmap
+${STATS_HASH} hash = "compat";
+${STATS_KEY} key = "${KEY_PVT1}";
+${STATS_PATH_CACHE} name = "sqlite3"; path = "\${TMPDIR}/learn_cache.db";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test
diff --git a/test/functional/cases/110_statistics/compat-plain.robot b/test/functional/cases/110_statistics/compat-plain.robot
new file mode 100644
index 000000000..12bbaedcd
--- /dev/null
+++ b/test/functional/cases/110_statistics/compat-plain.robot
@@ -0,0 +1,19 @@
+*** Settings ***
+Suite Setup Statistics Setup
+Suite Teardown Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${STATS_BACKEND} mmap
+${STATS_HASH} hash = "compat";
+${STATS_PATH_CACHE} name = "sqlite3"; path = "\${TMPDIR}/learn_cache.db";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test
diff --git a/test/functional/cases/110_statistics/lib.robot b/test/functional/cases/110_statistics/lib.robot
new file mode 100644
index 000000000..5f9e96038
--- /dev/null
+++ b/test/functional/cases/110_statistics/lib.robot
@@ -0,0 +1,57 @@
+*** Settings ***
+Library ${TESTDIR}/lib/rspamd.py
+Resource ${TESTDIR}/lib/rspamd.robot
+Variables ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${CONFIG} ${TESTDIR}/configs/stats.conf
+${MESSAGE} ${TESTDIR}/messages/spam_message.eml
+${REDIS_SCOPE} Suite
+${REDIS_SERVER} ${EMPTY}
+${RSPAMD_SCOPE} Suite
+${STATS_HASH} ${EMPTY}
+${STATS_KEY} ${EMPTY}
+${STATS_PATH_CACHE} path = "\${TMPDIR}/bayes-cache.sqlite";
+${STATS_PATH_HAM} path = "\${TMPDIR}/bayes-ham.sqlite";
+${STATS_PATH_SPAM} path = "\${TMPDIR}/bayes-spam.sqlite";
+
+*** Keywords ***
+Broken Learn Test
+ ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE}
+ Check Rspamc ${result} cannot find statfile backend
+
+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}
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} BAYES_SPAM
+
+Learn Test
+ Set Suite Variable ${RSPAMD_STATS_LEARNTEST} 0
+ ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} learn_spam ${MESSAGE}
+ Check Rspamc ${result}
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} BAYES_SPAM
+ 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}
+ Check Rspamc ${result}
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} BAYES_HAM
+
+Redis Statistics Setup
+ Generic Setup
+ Run Redis
+
+Redis Statistics Teardown
+ Generic Teardown
+ Shutdown Process With Children ${REDIS_PID}
+
+Statistics Setup
+ Generic Setup STATS_PATH_CACHE STATS_PATH_HAM STATS_PATH_SPAM
+
+Statistics Teardown
+ Generic Teardown
diff --git a/test/functional/cases/110_statistics/redis-keyed-siphash.robot b/test/functional/cases/110_statistics/redis-keyed-siphash.robot
new file mode 100644
index 000000000..ec95efcd1
--- /dev/null
+++ b/test/functional/cases/110_statistics/redis-keyed-siphash.robot
@@ -0,0 +1,20 @@
+*** Settings ***
+Suite Setup Redis Statistics Setup
+Suite Teardown Redis Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${REDIS_SERVER} servers = "${REDIS_ADDR}:${REDIS_PORT}"
+${STATS_BACKEND} redis
+${STATS_HASH} hash = "siphash";
+${STATS_KEY} key = "${KEY_PVT1}";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test
diff --git a/test/functional/cases/110_statistics/redis-keyed-xxhash.robot b/test/functional/cases/110_statistics/redis-keyed-xxhash.robot
new file mode 100644
index 000000000..5a7b2daf3
--- /dev/null
+++ b/test/functional/cases/110_statistics/redis-keyed-xxhash.robot
@@ -0,0 +1,20 @@
+*** Settings ***
+Suite Setup Redis Statistics Setup
+Suite Teardown Redis Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${REDIS_SERVER} servers = "${REDIS_ADDR}:${REDIS_PORT}"
+${STATS_BACKEND} redis
+${STATS_HASH} hash = "xxhash";
+${STATS_KEY} key = "${KEY_PVT1}";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test
diff --git a/test/functional/cases/110_statistics/redis-plain-siphash.robot b/test/functional/cases/110_statistics/redis-plain-siphash.robot
new file mode 100644
index 000000000..d436b1a68
--- /dev/null
+++ b/test/functional/cases/110_statistics/redis-plain-siphash.robot
@@ -0,0 +1,19 @@
+*** Settings ***
+Suite Setup Redis Statistics Setup
+Suite Teardown Redis Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${REDIS_SERVER} servers = "${REDIS_ADDR}:${REDIS_PORT}"
+${STATS_BACKEND} redis
+${STATS_HASH} hash = "siphash";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test
diff --git a/test/functional/cases/110_statistics/redis-plain-xxhash.robot b/test/functional/cases/110_statistics/redis-plain-xxhash.robot
new file mode 100644
index 000000000..0c45ac16b
--- /dev/null
+++ b/test/functional/cases/110_statistics/redis-plain-xxhash.robot
@@ -0,0 +1,19 @@
+*** Settings ***
+Suite Setup Redis Statistics Setup
+Suite Teardown Redis Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${REDIS_SERVER} servers = "${REDIS_ADDR}:${REDIS_PORT}"
+${STATS_BACKEND} redis
+${STATS_HASH} hash = "xxhash";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test
diff --git a/test/functional/cases/110_statistics/sqlite-broken-stats-dir.robot b/test/functional/cases/110_statistics/sqlite-broken-stats-dir.robot
new file mode 100644
index 000000000..57d75c294
--- /dev/null
+++ b/test/functional/cases/110_statistics/sqlite-broken-stats-dir.robot
@@ -0,0 +1,15 @@
+*** Settings ***
+Suite Setup Generic Setup
+Suite Teardown Generic Teardown
+Resource ${TESTDIR}/lib/rspamd.robot
+Resource lib.robot
+
+*** Variables ***
+${STATS_BACKEND} sqlite3
+${STATS_PATH_CACHE} path = "/does/not/exist/bayes-cache.sqlite";
+${STATS_PATH_HAM} path = "/does/not/exist/bayes-ham.sqlite";
+${STATS_PATH_SPAM} path = "/does/not/exist/bayes-spam.sqlite";
+
+*** Test Cases ***
+Broken Stats Directory
+ Broken Learn Test
diff --git a/test/functional/cases/110_statistics/sqlite-keyed-siphash.robot b/test/functional/cases/110_statistics/sqlite-keyed-siphash.robot
new file mode 100644
index 000000000..8b9661a9a
--- /dev/null
+++ b/test/functional/cases/110_statistics/sqlite-keyed-siphash.robot
@@ -0,0 +1,19 @@
+*** Settings ***
+Suite Setup Statistics Setup
+Suite Teardown Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${STATS_BACKEND} sqlite3
+${STATS_HASH} hash = "siphash";
+${STATS_KEY} key = "${KEY_PVT1}";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test
diff --git a/test/functional/cases/110_statistics/sqlite-keyed-xxhash.robot b/test/functional/cases/110_statistics/sqlite-keyed-xxhash.robot
new file mode 100644
index 000000000..7a51e93ae
--- /dev/null
+++ b/test/functional/cases/110_statistics/sqlite-keyed-xxhash.robot
@@ -0,0 +1,19 @@
+*** Settings ***
+Suite Setup Statistics Setup
+Suite Teardown Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${STATS_BACKEND} sqlite3
+${STATS_HASH} hash = "xxhash";
+${STATS_KEY} key = "${KEY_PVT1}";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test
diff --git a/test/functional/cases/110_statistics/sqlite-plain-siphash.robot b/test/functional/cases/110_statistics/sqlite-plain-siphash.robot
new file mode 100644
index 000000000..2f88e0a95
--- /dev/null
+++ b/test/functional/cases/110_statistics/sqlite-plain-siphash.robot
@@ -0,0 +1,18 @@
+*** Settings ***
+Suite Setup Statistics Setup
+Suite Teardown Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${STATS_BACKEND} sqlite3
+${STATS_HASH} hash = "siphash";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test
diff --git a/test/functional/cases/110_statistics/sqlite-plain-xxhash.robot b/test/functional/cases/110_statistics/sqlite-plain-xxhash.robot
new file mode 100644
index 000000000..dd8198222
--- /dev/null
+++ b/test/functional/cases/110_statistics/sqlite-plain-xxhash.robot
@@ -0,0 +1,18 @@
+*** Settings ***
+Suite Setup Statistics Setup
+Suite Teardown Statistics Teardown
+Resource lib.robot
+
+*** Variables ***
+${STATS_BACKEND} sqlite3
+${STATS_HASH} hash = "xxhash";
+
+*** Test Cases ***
+Learn
+ Learn Test
+
+Relearn
+ Relearn Test
+
+Empty Part
+ Empty Part Test