]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Use BATS_TMPDIR instead of '/tmp' for tests.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Jul 2015 07:10:51 +0000 (08:10 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Jul 2015 07:10:51 +0000 (08:10 +0100)
test/functional/configs/stats.conf
test/functional/configs/trivial.conf
test/functional/test_helper.bash

index d1ff23e620391de8fe80024505fb685c43bb8008..cb1c14a1917b90be470f79e23963d6f9c9c04d42 100644 (file)
@@ -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;
        }
 }
index 896f2b4ff8e12b288ce6c7661255cc43ba855f1a..a39544a53fdc1ed139f7f5332675b9883c54a421 100644 (file)
@@ -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",
index 32d8f8e008345b5b8d70643b6ff8de76f72e2446..4323109b94b0dd67037e4df1562cba64114c5d81 100644 (file)
@@ -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       
 }