2012-07-13 00:08:21 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Must match redis_port in config/environments/test.js
|
|
|
|
# TODO: read from there
|
|
|
|
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}"
|
2012-07-13 04:55:34 +08:00
|
|
|
echo "port ${REDIS_PORT}" | redis-server - > test/test.log &
|
2012-07-13 00:08:21 +08:00
|
|
|
PID_REDIS=$!
|
|
|
|
|
|
|
|
echo "Preparing the environment"
|
2012-07-24 15:45:08 +08:00
|
|
|
cd test; sh prepare_db.sh || die "database preparation failure"; cd -;
|
2012-07-13 00:08:21 +08:00
|
|
|
|
|
|
|
PATH=node_modules/.bin/:$PATH
|
|
|
|
|
|
|
|
echo "Running tests"
|
2012-07-13 04:54:12 +08:00
|
|
|
mocha -u tdd \
|
2012-07-13 00:21:39 +08:00
|
|
|
test/unit/redis_pool.test.js \
|
|
|
|
test/unit/metadata.test.js \
|
2012-07-13 02:16:38 +08:00
|
|
|
test/unit/oauth.test.js \
|
2012-09-04 17:22:53 +08:00
|
|
|
test/unit/psql.test.js \
|
2012-07-16 19:41:44 +08:00
|
|
|
test/acceptance/app.test.js \
|
|
|
|
test/acceptance/app.auth.test.js
|
2012-07-13 00:08:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
cleanup
|