aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-07 08:10:51 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-07 08:10:51 +0100
commit61d68ce55e03ed4667a5b647c0f286005ce01c85 (patch)
treef5f4dd3a3cce258997c3284d2eed6139a3040a9f /test
parent23ab4cf76ef156db35dfaae704966fd0963c12d6 (diff)
downloadrspamd-61d68ce55e03ed4667a5b647c0f286005ce01c85.tar.gz
rspamd-61d68ce55e03ed4667a5b647c0f286005ce01c85.zip
Use BATS_TMPDIR instead of '/tmp' for tests.
Diffstat (limited to 'test')
-rw-r--r--test/functional/configs/stats.conf10
-rw-r--r--test/functional/configs/trivial.conf4
-rw-r--r--test/functional/test_helper.bash9
3 files changed, 13 insertions, 10 deletions
diff --git a/test/functional/configs/stats.conf b/test/functional/configs/stats.conf
index d1ff23e62..cb1c14a19 100644
--- a/test/functional/configs/stats.conf
+++ b/test/functional/configs/stats.conf
@@ -4,12 +4,12 @@ options = {
dns = {
nameserver = "8.8.8.8"
}
- pidfile = "/tmp/rspamd-bats.pid"
+ pidfile = "${TMPDIR}/rspamd-bats.pid"
}
logging = {
type = "file",
level = "debug"
- filename = "/tmp/rspamd-bats.log"
+ filename = "${TMPDIR}/rspamd-bats.log"
}
metric = {
name = "default",
@@ -45,17 +45,17 @@ classifier {
}
statfile {
symbol = BAYES_SPAM;
- path = /tmp/rspamd-bats-bayes.spam;
+ path = ${TMPDIR}/rspamd-bats-bayes.spam;
size = 1M;
}
statfile {
symbol = BAYES_HAM;
- path = /tmp/rspamd-bats-bayes.ham;
+ path = ${TMPDIR}/rspamd-bats-bayes.ham;
size = 1M;
}
cache {
name = "sqlite3";
- path = /tmp/rspamd-bats-cache.sqlite;
+ path = ${TMPDIR}/rspamd-bats-cache.sqlite;
}
}
diff --git a/test/functional/configs/trivial.conf b/test/functional/configs/trivial.conf
index 896f2b4ff..a39544a53 100644
--- a/test/functional/configs/trivial.conf
+++ b/test/functional/configs/trivial.conf
@@ -4,12 +4,12 @@ options = {
dns = {
nameserver = "8.8.8.8"
}
- pidfile = "/tmp/rspamd-bats.pid"
+ pidfile = "${TMPDIR}/rspamd-bats.pid"
}
logging = {
type = "file",
level = "debug"
- filename = "/tmp/rspamd-bats.log"
+ filename = "${TMPDIR}/rspamd-bats.log"
}
metric = {
name = "default",
diff --git a/test/functional/test_helper.bash b/test/functional/test_helper.bash
index 32d8f8e00..4323109b9 100644
--- a/test/functional/test_helper.bash
+++ b/test/functional/test_helper.bash
@@ -1,10 +1,13 @@
+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"}
- if [ -f /tmp/rspamd-bats.log ] ; then rm -f /tmp/rspamd-bats.log ; fi
- ${RSPAMD} -c ${RSPAMD_CONFIG} -u ${RSPAMD_USER} -g ${RSPAMD_GROUP}
+ 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}
}
@@ -13,5 +16,5 @@ function teardown() {
}
function clear_stats() {
- rm -f /tmp/rspamd-bats-cache.sqlite /tmp/rspamd-bats-bayes.spam /tmp/rspamd-bats-bayes.ham || true
+ rm -f ${TMPDIR}/rspamd-bats-cache.sqlite ${TMPDIR}/rspamd-bats-bayes.spam ${TMPDIR}/rspamd-bats-bayes.ham || true
}