aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/cases')
-rw-r--r--test/functional/cases/encrypted_gtube.sh9
-rw-r--r--test/functional/cases/gtube.sh8
-rw-r--r--test/functional/cases/learn_bad.sh12
-rw-r--r--test/functional/cases/learn_empty.sh17
-rw-r--r--test/functional/cases/learn_simple.sh17
-rw-r--r--test/functional/cases/learn_siphash.sh18
-rw-r--r--test/functional/cases/learn_xxhash.sh18
-rw-r--r--test/functional/cases/relearn-sqlite.sh28
-rw-r--r--test/functional/cases/relearn.sh27
-rw-r--r--test/functional/cases/spamc_gtube.sh8
-rw-r--r--test/functional/cases/symbol_depends.sh14
11 files changed, 176 insertions, 0 deletions
diff --git a/test/functional/cases/encrypted_gtube.sh b/test/functional/cases/encrypted_gtube.sh
new file mode 100644
index 000000000..9b5ff27e6
--- /dev/null
+++ b/test/functional/cases/encrypted_gtube.sh
@@ -0,0 +1,9 @@
+# Test rspamd encrypted using gtube
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/trivial.conf"
+run_rspamd
+run_rspamc symbols --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$TEST_DIRNAME/messages/gtube.eml"
+check_output "$output" 'Action: reject' \ No newline at end of file
diff --git a/test/functional/cases/gtube.sh b/test/functional/cases/gtube.sh
new file mode 100644
index 000000000..795b0dc45
--- /dev/null
+++ b/test/functional/cases/gtube.sh
@@ -0,0 +1,8 @@
+# Test rspamd using gtube
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/trivial.conf"
+run_rspamd
+run_rspamc symbols "$TEST_DIRNAME/messages/gtube.eml"
+check_output "$output" 'Action: reject' \ No newline at end of file
diff --git a/test/functional/cases/learn_bad.sh b/test/functional/cases/learn_bad.sh
new file mode 100644
index 000000000..199e77b7f
--- /dev/null
+++ b/test/functional/cases/learn_bad.sh
@@ -0,0 +1,12 @@
+# Test rspamd learn with bad stats
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=/non/existent
+
+run_rspamd
+run_rspamc learn_spam \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'cannot open backend' \ No newline at end of file
diff --git a/test/functional/cases/learn_empty.sh b/test/functional/cases/learn_empty.sh
new file mode 100644
index 000000000..855979fd3
--- /dev/null
+++ b/test/functional/cases/learn_empty.sh
@@ -0,0 +1,17 @@
+# Test rspamd learn empty part
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=${TMPDIR}
+
+run_rspamd
+run_rspamc learn_spam \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/empty_part.eml"
+check_output $output 'success.*true'
+
+run_rspamc symbols \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/empty_part.eml"
+check_output $output 'BAYES_SPAM' \ No newline at end of file
diff --git a/test/functional/cases/learn_simple.sh b/test/functional/cases/learn_simple.sh
new file mode 100644
index 000000000..59a0bac5b
--- /dev/null
+++ b/test/functional/cases/learn_simple.sh
@@ -0,0 +1,17 @@
+# Test rspamd learn
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=${TMPDIR}
+
+run_rspamd
+run_rspamc learn_spam \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'success.*true'
+
+run_rspamc symbols \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'BAYES_SPAM' \ No newline at end of file
diff --git a/test/functional/cases/learn_siphash.sh b/test/functional/cases/learn_siphash.sh
new file mode 100644
index 000000000..a91fe9ae9
--- /dev/null
+++ b/test/functional/cases/learn_siphash.sh
@@ -0,0 +1,18 @@
+# Test rspamd learn using siphash
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=${TMPDIR} \
+ STATS_HASH="siphash"
+
+run_rspamd
+run_rspamc learn_spam \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'success.*true'
+
+run_rspamc symbols \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'BAYES_SPAM' \ No newline at end of file
diff --git a/test/functional/cases/learn_xxhash.sh b/test/functional/cases/learn_xxhash.sh
new file mode 100644
index 000000000..896874b13
--- /dev/null
+++ b/test/functional/cases/learn_xxhash.sh
@@ -0,0 +1,18 @@
+# Test rspamd learn using xxhash
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=${TMPDIR} \
+ STATS_HASH="xxh"
+
+run_rspamd
+run_rspamc learn_spam \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'success.*true'
+
+run_rspamc symbols \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'BAYES_SPAM' \ No newline at end of file
diff --git a/test/functional/cases/relearn-sqlite.sh b/test/functional/cases/relearn-sqlite.sh
new file mode 100644
index 000000000..1b2ac4a8c
--- /dev/null
+++ b/test/functional/cases/relearn-sqlite.sh
@@ -0,0 +1,28 @@
+# Test rspamd re-learn sqlite3 backend
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=${TMPDIR} \
+ STATS_BACKEND="sqlite3"
+
+run_rspamd
+run_rspamc learn_spam \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'success.*true'
+
+run_rspamc symbols \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'BAYES_SPAM'
+
+run_rspamc learn_ham \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'success.*true'
+
+run_rspamc symbols \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'BAYES_HAM' \ No newline at end of file
diff --git a/test/functional/cases/relearn.sh b/test/functional/cases/relearn.sh
new file mode 100644
index 000000000..d1f861922
--- /dev/null
+++ b/test/functional/cases/relearn.sh
@@ -0,0 +1,27 @@
+# Test rspamd re-learn
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=${TMPDIR}
+
+run_rspamd
+run_rspamc learn_spam \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'success.*true'
+
+run_rspamc symbols \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'BAYES_SPAM'
+
+run_rspamc learn_ham \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'success.*true'
+
+run_rspamc symbols \
+ --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'BAYES_HAM' \ No newline at end of file
diff --git a/test/functional/cases/spamc_gtube.sh b/test/functional/cases/spamc_gtube.sh
new file mode 100644
index 000000000..8b63eb5fd
--- /dev/null
+++ b/test/functional/cases/spamc_gtube.sh
@@ -0,0 +1,8 @@
+# Test rspamd spamc gtube
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/trivial.conf"
+run_rspamd
+run perl "$TEST_DIRNAME/cases/spamc.pl" "$TEST_DIRNAME/messages/gtube.eml"
+check_output $output 'GTUBE' \ No newline at end of file
diff --git a/test/functional/cases/symbol_depends.sh b/test/functional/cases/symbol_depends.sh
new file mode 100644
index 000000000..5bc6941c3
--- /dev/null
+++ b/test/functional/cases/symbol_depends.sh
@@ -0,0 +1,14 @@
+# Test rspamd symbol dependencies
+
+. ${TEST_DIRNAME}/functions.sh
+
+sed -e 's|@@LUA_SCRIPT@@|${CURDIR}/functional/cases/deps.lua|' < \
+ "$TEST_DIRNAME/configs/lua_test.conf" > \
+ "$TMPDIR/rspamd.conf"
+export RSPAMD_CONFIG="$TMPDIR/rspamd.conf" \
+ STATSDIR=${TMPDIR}
+run_rspamd
+
+run_rspamc symbols \
+ "$BATS_TEST_DIRNAME/messages/spam_message.eml"
+check_output $output 'DEP10' \ No newline at end of file