tests: do not hardcode /tmp

It's better to use $TMPDIR if available.

Change-Id: I33599e7acf8e0cf833b3b01e8a202013a3add753
This commit is contained in:
Julien Danjou 2016-01-05 12:21:27 +01:00
parent de9308e154
commit 5342f52f4c
4 changed files with 7 additions and 6 deletions

View File

@ -31,7 +31,7 @@ trap "clean_exit" EXIT
export PATH=$PATH:/usr/libexec
# Start MySQL process for tests
MYSQL_DATA=`mktemp -d /tmp/tooz-mysql-XXXXX`
MYSQL_DATA=`mktemp -d -t tooz-mysql-XXXXX`
mkfifo ${MYSQL_DATA}/out
# Initialize MySQL Data Directory
mysql_install_db --user=${USER} --ldata=${MYSQL_DATA}

View File

@ -11,7 +11,7 @@ function clean_exit() {
trap "clean_exit" EXIT
# Start PostgreSQL process for tests
PGSQL_DATA=`mktemp -d /tmp/tooz-pgsql-XXXXX`
PGSQL_DATA=`mktemp -d -t tooz-pgsql-XXXXX`
PGSQL_PATH=`pg_config --bindir`
PGSQL_PORT=9825
${PGSQL_PATH}/initdb ${PGSQL_DATA}

View File

@ -3,6 +3,7 @@ set -x -e
SENTINEL_PORTS="26381 26382 26383"
CONFFILES=()
TMPDIR=${TMPDIR:/tmp}
function clean_exit(){
local error_code="$?"
@ -11,7 +12,7 @@ function clean_exit(){
kill $(jobs -p)
fi
wait $spawned
rm /tmp/sentinel.2638[123].log || true
rm /$TMPDIR/sentinel.2638[123].log || true
rm ${CONFFILES[@]} || true
return $error_code
}
@ -21,12 +22,12 @@ function write_conf_file() {
local conffile=$(mktemp -t tooz-sentinel-$port-XXXXXX)
cat > $conffile <<EOF
port $port
dir /tmp
dir $TMPDIR
sentinel monitor mainbarn 127.0.0.1 6381 2
sentinel down-after-milliseconds mainbarn 80000
sentinel parallel-syncs mainbarn 1
sentinel failover-timeout mainbarn 180000
logfile /tmp/sentinel.$port.log
logfile $TMPDIR/sentinel.$port.log
EOF
echo $conffile
}

View File

@ -3,7 +3,7 @@ set -x -e
ZOO_CONF=/etc/zookeeper
ZOO_BIN=/usr/share/zookeeper/bin
ZOO_TMP_DIR=$(mktemp -d /tmp/ZOO-TMP-XXXXX)
ZOO_TMP_DIR=$(mktemp -d -t ZOO-TMP-XXXXX)
ZOOKEEPER_STARTED=0
mkdir $ZOO_TMP_DIR/bin