CartoDB-SQL-API/test/run_tests.sh
Sandro Santilli debc0c2586 Run tests on "make check", using custom port for redis
Includes tweaks in the db preparation script and in the tests
for proper handling of async model. Only a single test is run
at the moment, being the only one that succeeded for me.
2012-07-12 18:10:56 +02:00

46 lines
842 B
Bash
Executable File

#!/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}"
echo "port ${REDIS_PORT}" | redis-server - > test.log &
PID_REDIS=$!
echo "Preparing the environment"
cd test; sh prepare_db.sh >> test.log || die "database preparation failure (see test.log)"; cd -;
PATH=node_modules/.bin/:$PATH
echo "Running tests"
expresso test/unit/redis_pool.test.js
# expresso test/unit/metadata.test.js # fails (#36)
#expresso test/unit/oauth.test.js
#expresso test/unit/psql.test.js
#expresso test/acceptance/app.test.js
#expresso test/acceptance/app.auth.test.js
cleanup