2012-07-10 00:56:09 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Must match config.redis_pool.port in test/support/config.js
|
|
|
|
REDIS_PORT=6333
|
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
echo "Cleaning up"
|
|
|
|
kill ${PID_REDIS}
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup_and_exit() {
|
|
|
|
cleanup
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
die() {
|
|
|
|
msg=$1
|
|
|
|
echo "${msg}" >&2
|
|
|
|
cleanup
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
trap 'cleanup_and_exit' 1 2 3 5 9 13
|
|
|
|
|
|
|
|
echo "Starting redis on port ${REDIS_PORT}"
|
|
|
|
echo "port ${REDIS_PORT}" | redis-server - > test.log &
|
|
|
|
PID_REDIS=$!
|
|
|
|
|
|
|
|
echo "Preparing the database"
|
2012-07-06 18:54:48 +08:00
|
|
|
cd test/support; sh prepare_db.sh >> test.log || die "database preparation failure (see test.log)"; cd -;
|
2012-07-10 00:56:09 +08:00
|
|
|
|
|
|
|
PATH=node_modules/.bin/:$PATH
|
|
|
|
|
2012-07-10 22:36:20 +08:00
|
|
|
echo "Running tests"
|
|
|
|
mocha -u tdd \
|
|
|
|
test/unit/cartodb/redis_pool.test.js \
|
2012-07-18 17:00:24 +08:00
|
|
|
test/unit/cartodb/req2params.test.js \
|
2012-07-10 22:36:20 +08:00
|
|
|
test/acceptance/cache_validator.js \
|
|
|
|
test/acceptance/server.js
|
2012-07-10 00:56:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
cleanup
|