aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-09 14:41:28 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-09 14:41:28 +0100
commit864de26de100c10f95501cd9ebf647360be7252e (patch)
treeaeb105178bc6a652984f69303bbb4858a6a2687a /test
parentc7fb13cdc359d810b82753b4fbfc3182145990d9 (diff)
downloadrspamd-864de26de100c10f95501cd9ebf647360be7252e.tar.gz
rspamd-864de26de100c10f95501cd9ebf647360be7252e.zip
Remove bats tests.
Diffstat (limited to 'test')
-rw-r--r--test/functional/test_helper.bash61
-rw-r--r--test/functional/tests.bats216
2 files changed, 0 insertions, 277 deletions
diff --git a/test/functional/test_helper.bash b/test/functional/test_helper.bash
deleted file mode 100644
index 3fdbd6554..000000000
--- a/test/functional/test_helper.bash
+++ /dev/null
@@ -1,61 +0,0 @@
-TMPDIR=${BATS_TMPDIR}
-
-function run_rspamd() {
- TMPDIR=${BATS_TMPDIR}
- RSPAMD_USER=${RSPAMD_USER:-"nobody"}
- RSPAMD_GROUP=${RSPAMD_GROUP:-"nogroup"}
- RSPAMD=${RSPAMD:-"$BATS_TEST_DIRNAME/../../src/rspamd"}
- STATS_BACKEND=${STATS_BACKEND:-"mmap"}
- STATS_HASH=${STATS_HASH:-"compat"}
- STATS_KEY=${STATS_KEY:-"osipg87ms5gzsis33fdrhaqn5wocp6qfofzxjbw8k1wh9yb6adty"}
-
- if [ -f ${TMPDIR}/rspamd-bats-${BATS_TEST_NAME}.log ] ; then
- rm -f ${TMPDIR}/rspamd-bats-${BATS_TEST_NAME}.log
- fi
- ${RSPAMD} -c ${RSPAMD_CONFIG} -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} \
- TMPDIR=${TMPDIR} \
- STATSDIR=${STATSDIR} \
- LUADIR=${LUADIR} \
- TEST_NUM=${BATS_TEST_NAME} \
- STATS_BACKEND=${STATS_BACKEND} \
- STATS_HASH=${STATS_HASH} \
- STATS_KEY=${STATS_KEY}
-}
-
-
-function teardown() {
- (
- pgrep rspamd > /dev/null 2>&1
- while [ $? -eq 0 ] ; do
- pkill -TERM rspamd || true
- pgrep rspamd > /dev/null 2>&1
- if [ $? -eq 0 ] ; then
- sleep 0.1
- fi
- pgrep rspamd > /dev/null 2>&1
- done
- ) || true
-}
-
-function clear_stats() {
- rm -f ${STATSDIR}/rspamd-bats-cache.sqlite \
- ${STATSDIR}/rspamd-bats-bayes.spam \
- ${STATSDIR}/rspamd-bats-bayes.ham || true
-}
-
-function check_output() {
- _output="$1"
- _pattern="$2"
-
- (
- echo $_output | egrep $_pattern
-
- _saved_exit=$?
- if [ $_saved_exit -ne 0 ] ; then
- printf "Expected pattern %s, while get output:\n%s\nEND\n" $_pattern $_output >&2
- return $_saved_exit
- fi
-
- return 0
- )
-}
diff --git a/test/functional/tests.bats b/test/functional/tests.bats
deleted file mode 100644
index dbf77a758..000000000
--- a/test/functional/tests.bats
+++ /dev/null
@@ -1,216 +0,0 @@
-load test_helper
-
-RSPAMC="$BATS_TEST_DIRNAME/../../src/client/rspamc"
-
-@test "Test rspamd using gtube" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/trivial.conf"
- run_rspamd
- run ${RSPAMC} -h localhost:56789 \
- "$BATS_TEST_DIRNAME/messages/gtube.eml"
- [ "$status" -eq 0 ]
-
- check_output $output 'Action: reject'
-}
-
-@test "Test rspamd encrypted using gtube" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/trivial.conf"
- run_rspamd
- run ${RSPAMC} -h localhost:56789 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/gtube.eml"
- [ "$status" -eq 0 ]
-
- check_output $output 'Action: reject'
-}
-
-@test "Test rspamd spamc gtube" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/trivial.conf"
- run_rspamd
- run perl $BATS_TEST_DIRNAME/cases/spamc.pl "$BATS_TEST_DIRNAME/messages/gtube.eml"
- [ "$status" -eq 0 ]
- check_output $output 'GTUBE'
-}
-
-@test "Test rspamd streamlined gtube" {
- skip
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/trivial.conf"
- run_rspamd
- run perl $BATS_TEST_DIRNAME/cases/http_streamline.pl "$BATS_TEST_DIRNAME/messages/gtube.eml"
- [ "$status" -eq 0 ]
- check_output $output 'Action: reject'
-}
-
-@test "Test rspamd learn" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
- STATSDIR=${BATS_TMPDIR}
- clear_stats
- run_rspamd
- run ${RSPAMC} -h localhost:56790 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- learn_spam \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
- check_output $output 'success.*true'
-
- run ${RSPAMC} -h localhost:56789 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- symbols \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
- check_output $output 'BAYES_SPAM'
- clear_stats
-}
-
-@test "Test rspamd re-learn" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
- STATSDIR=${BATS_TMPDIR}
- clear_stats
- run_rspamd
- run ${RSPAMC} -h localhost:56790 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- learn_spam \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
- check_output $output 'success.*true'
-
- run ${RSPAMC} -h localhost:56790 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- learn_ham \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
- check_output $output 'success.*true'
-
- run ${RSPAMC} -h localhost:56789 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- symbols \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
- check_output $output 'BAYES_HAM'
- clear_stats
-}
-
-@test "Test learn message with an empty part" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
- STATSDIR=${BATS_TMPDIR}
- clear_stats
- run_rspamd
- run ${RSPAMC} -h localhost:56790 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- learn_spam \
- "$BATS_TEST_DIRNAME/messages/empty_part.eml"
- [ "$status" -eq 0 ]
- check_output $output 'success.*true'
-
- run ${RSPAMC} -h localhost:56789 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- symbols \
- "$BATS_TEST_DIRNAME/messages/empty_part.eml"
- [ "$status" -eq 0 ]
- check_output $output 'BAYES_SPAM'
- clear_stats
-}
-
-@test "Test rspamd re-learn sqlite3 backend" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
- STATSDIR=${BATS_TMPDIR} \
- STATS_BACKEND="sqlite3"
- clear_stats
- run_rspamd
- run ${RSPAMC} -h localhost:56790 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- learn_spam \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
- check_output $output 'success.*true'
-
- run ${RSPAMC} -h localhost:56790 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- learn_ham \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
- check_output $output 'success.*true'
-
- run ${RSPAMC} -h localhost:56789 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- symbols \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
- check_output $output 'BAYES_HAM'
- clear_stats
-}
-
-@test "Test rspamd xxhash tokenizer" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
- STATSDIR=${BATS_TMPDIR} \
- STATS_HASH="xxh"
- clear_stats
- run_rspamd
- run ${RSPAMC} -h localhost:56790 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- learn_spam \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
-
- check_output $output 'success.*true'
-
- run ${RSPAMC} -h localhost:56789 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- symbols \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
-
- check_output $output 'BAYES_SPAM'
- clear_stats
-}
-
-@test "Test rspamd siphash tokenizer" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
- STATSDIR=${BATS_TMPDIR} \
- STATS_HASH="siphash"
- clear_stats
- run_rspamd
- run ${RSPAMC} -h localhost:56790 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- learn_spam \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
-
- check_output $output 'success.*true'
-
- run ${RSPAMC} -h localhost:56789 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- symbols \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
-
- check_output $output 'BAYES_SPAM'
- clear_stats
-}
-
-@test "Test learn message with bad statfiles" {
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
- STATSDIR=/non/existent
- run_rspamd
- run ${RSPAMC} -h localhost:56790 \
- --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- learn_spam \
- "$BATS_TEST_DIRNAME/messages/empty_part.eml"
- [ "$status" -eq 0 ]
-
- check_output $output 'cannot open backend'
-}
-
-@test "Test rspamd dependencies" {
- sed -e 's|@@LUA_SCRIPT@@|${CURDIR}/functional/cases/deps.lua|' < \
- "$BATS_TEST_DIRNAME/configs/lua_test.conf" > \
- "$BATS_TMPDIR/rspamd.conf"
- export RSPAMD_CONFIG="$BATS_TMPDIR/rspamd.conf" \
- STATSDIR=${BATS_TMPDIR}
- run_rspamd
- run ${RSPAMC} -h localhost:56789 \
- symbols \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
- [ "$status" -eq 0 ]
-
- check_output $output 'DEP10'
-} \ No newline at end of file