aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-08 16:32:12 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-08 16:32:12 +0100
commitd32a7cf4cab1003ab1dc9a953c181bb025fd15f1 (patch)
tree27b77430bc87e03e51487d0a57634eed3791a6d5
parente95ca5c778fb9dd0969c842ec57389025a9db913 (diff)
downloadrspamd-d32a7cf4cab1003ab1dc9a953c181bb025fd15f1.tar.gz
rspamd-d32a7cf4cab1003ab1dc9a953c181bb025fd15f1.zip
Use more UCL vars for tests.
-rw-r--r--test/functional/configs/lua_test.conf2
-rw-r--r--test/functional/configs/stats.conf8
-rw-r--r--test/functional/configs/trivial.conf2
-rw-r--r--test/functional/test_helper.bash14
-rw-r--r--test/functional/tests.bats12
5 files changed, 25 insertions, 13 deletions
diff --git a/test/functional/configs/lua_test.conf b/test/functional/configs/lua_test.conf
index 0cab3c59c..86d839709 100644
--- a/test/functional/configs/lua_test.conf
+++ b/test/functional/configs/lua_test.conf
@@ -9,7 +9,7 @@ options = {
logging = {
type = "file",
level = "debug"
- filename = "/tmp/rspamd-bats.log"
+ filename = "/tmp/rspamd-bats-${TEST_NUM}.log"
}
metric = {
name = "default",
diff --git a/test/functional/configs/stats.conf b/test/functional/configs/stats.conf
index cb1c14a19..b37615caa 100644
--- a/test/functional/configs/stats.conf
+++ b/test/functional/configs/stats.conf
@@ -9,7 +9,7 @@ options = {
logging = {
type = "file",
level = "debug"
- filename = "${TMPDIR}/rspamd-bats.log"
+ filename = "${TMPDIR}/rspamd-bats-${TEST_NUM}.log"
}
metric = {
name = "default",
@@ -45,17 +45,17 @@ classifier {
}
statfile {
symbol = BAYES_SPAM;
- path = ${TMPDIR}/rspamd-bats-bayes.spam;
+ path = ${STATSDIR}/rspamd-bats-bayes.spam;
size = 1M;
}
statfile {
symbol = BAYES_HAM;
- path = ${TMPDIR}/rspamd-bats-bayes.ham;
+ path = ${STATSDIR}/rspamd-bats-bayes.ham;
size = 1M;
}
cache {
name = "sqlite3";
- path = ${TMPDIR}/rspamd-bats-cache.sqlite;
+ path = ${STATSDIR}/rspamd-bats-cache.sqlite;
}
}
diff --git a/test/functional/configs/trivial.conf b/test/functional/configs/trivial.conf
index a39544a53..3302ea431 100644
--- a/test/functional/configs/trivial.conf
+++ b/test/functional/configs/trivial.conf
@@ -9,7 +9,7 @@ options = {
logging = {
type = "file",
level = "debug"
- filename = "${TMPDIR}/rspamd-bats.log"
+ filename = "${TMPDIR}/rspamd-bats-${TEST_NUM}.log"
}
metric = {
name = "default",
diff --git a/test/functional/test_helper.bash b/test/functional/test_helper.bash
index 239160f2c..5ee2e20ae 100644
--- a/test/functional/test_helper.bash
+++ b/test/functional/test_helper.bash
@@ -6,8 +6,14 @@ function run_rspamd() {
RSPAMD_GROUP=${RSPAMD_GROUP:-"nogroup"}
RSPAMD=${RSPAMD:-"$BATS_TEST_DIRNAME/../../src/rspamd"}
- if [ -f ${TMPDIR}/rspamd-bats.log ] ; then rm -f ${TMPDIR}/rspamd-bats.log ; fi
- ${RSPAMD} -c ${RSPAMD_CONFIG} -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} TMPDIR=${TMPDIR}
+ if [ -f ${TMPDIR}/rspamd-bats-${BATS_TEST_NUMBER}.log ] ; then
+ rm -f ${TMPDIR}/rspamd-bats-${BATS_TEST_NUMBER}.log
+ fi
+ ${RSPAMD} -c ${RSPAMD_CONFIG} -u ${RSPAMD_USER} -g ${RSPAMD_GROUP} \
+ TMPDIR=${TMPDIR} \
+ STATSDIR=${STATSDIR} \
+ LUADIR=${LUADIR} \
+ TEST_NUM=${BATS_TEST_NUMBER}
}
@@ -22,5 +28,7 @@ function teardown() {
}
function clear_stats() {
- rm -f ${TMPDIR}/rspamd-bats-cache.sqlite ${TMPDIR}/rspamd-bats-bayes.spam ${TMPDIR}/rspamd-bats-bayes.ham || true
+ rm -f ${STATSDIR}/rspamd-bats-cache.sqlite \
+ ${STATSDIR}/rspamd-bats-bayes.spam \
+ ${STATSDIR}/rspamd-bats-bayes.ham || true
}
diff --git a/test/functional/tests.bats b/test/functional/tests.bats
index 804c54a0e..94051ca89 100644
--- a/test/functional/tests.bats
+++ b/test/functional/tests.bats
@@ -44,7 +44,8 @@ RSPAMC="$BATS_TEST_DIRNAME/../../src/client/rspamc"
@test "Test rspamd learn" {
clear_stats
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf"
+ export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=${BATS_TMPDIR}
run_rspamd
run ${RSPAMC} -h localhost:56790 \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
@@ -66,7 +67,8 @@ RSPAMC="$BATS_TEST_DIRNAME/../../src/client/rspamc"
@test "Test rspamd re-learn" {
clear_stats
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf"
+ export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=${BATS_TMPDIR}
run_rspamd
run ${RSPAMC} -h localhost:56790 \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
@@ -96,7 +98,8 @@ RSPAMC="$BATS_TEST_DIRNAME/../../src/client/rspamc"
@test "Test learn message with an empty part" {
clear_stats
- export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf"
+ export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf" \
+ STATSDIR=${BATS_TMPDIR}
run_rspamd
run ${RSPAMC} -h localhost:56790 \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
@@ -121,7 +124,8 @@ RSPAMC="$BATS_TEST_DIRNAME/../../src/client/rspamc"
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"
+ export RSPAMD_CONFIG="$BATS_TMPDIR/rspamd.conf" \
+ STATSDIR=${BATS_TMPDIR}
run_rspamd
run ${RSPAMC} -h localhost:56789 \
symbols \