From 61d68ce55e03ed4667a5b647c0f286005ce01c85 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 7 Jul 2015 08:10:51 +0100 Subject: [PATCH] Use BATS_TMPDIR instead of '/tmp' for tests. --- test/functional/configs/stats.conf | 10 +++++----- test/functional/configs/trivial.conf | 4 ++-- test/functional/test_helper.bash | 9 ++++++--- 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 } -- 2.39.5