Merge branch 'master' into develop

Conflicts:
	Makefile
	NEWS.md
	package.json
This commit is contained in:
Sandro Santilli 2012-12-21 13:30:14 +01:00
commit 6e8bfffff1
3 changed files with 61 additions and 15 deletions

View File

@ -8,7 +8,11 @@ config/environments/test.js: config/environments/test.js.example
./configure ./configure
check-local: config/environments/test.js check-local: config/environments/test.js
./run_tests.sh ./run_tests.sh ${RUNTESTFLAGS} \
test/unit/cartodb/redis_pool.test.js \
test/unit/cartodb/req2params.test.js \
test/acceptance/cache_validator.js \
test/acceptance/server.js
check-submodules: check-submodules:
for sub in windshaft grainstore mapnik; do \ for sub in windshaft grainstore mapnik; do \
@ -18,3 +22,4 @@ check-submodules:
check-full: check-local check-submodules check-full: check-local check-submodules
check: check-local check: check-local

View File

@ -1,5 +1,7 @@
1.1.6 1.1.6
----- -----
* Require grainstore 0.10.9, fixing an issue with multi-geom markers
* Enhance run_tests.sh to allow running single tests and skipping preparation
1.1.5 (DD//MM//YY) 1.1.5 (DD//MM//YY)
----- -----

View File

@ -1,11 +1,28 @@
#!/bin/sh #!/bin/sh
# Must match config.redis_pool.port in test/support/config.js # Must match redis_port in config/environments/test.js
# TODO: read from there
REDIS_PORT=6333 REDIS_PORT=6333
OPT_CREATE=yes # create the test environment
OPT_DROP=yes # drop the test environment
cd $(dirname $0)
BASEDIR=$(pwd)
cd -
cleanup() { cleanup() {
echo "Cleaning up" if test x"$OPT_DROP" = xyes; then
kill ${PID_REDIS} if test x"$PID_REDIS" = x; then
PID_REDIS=$(cat ${BASEDIR}/redis.pid)
if test x"$PID_REDIS" = x; then
echo "Could not find a test redis pid to kill it"
return;
fi
fi
echo "Cleaning up"
kill ${PID_REDIS}
fi
} }
cleanup_and_exit() { cleanup_and_exit() {
@ -22,21 +39,43 @@ die() {
trap 'cleanup_and_exit' 1 2 3 5 9 13 trap 'cleanup_and_exit' 1 2 3 5 9 13
echo "Starting redis on port ${REDIS_PORT}" while [ -n "$1" ]; do
echo "port ${REDIS_PORT}" | redis-server - > test.log & if test "$1" = "--nodrop"; then
PID_REDIS=$! OPT_DROP=no
shift
continue
elif test "$1" = "--nocreate"; then
OPT_CREATE=no
shift
continue
else
break
fi
done
echo "Preparing the database" if [ -z "$1" ]; then
cd test/support; sh prepare_db.sh >> test.log || die "database preparation failure (see test.log)"; cd -; echo "Usage: $0 [<options>] <test> [<test>]" >&2
echo "Options:" >&2
echo " --nocreate do not create the test environment on start" >&2
echo " --nodrop do not drop the test environment on exit" >&2
exit 1
fi
TESTS=$@
if test x"$OPT_CREATE" = xyes; then
echo "Starting redis on port ${REDIS_PORT}"
echo "port ${REDIS_PORT}" | redis-server - > ${BASEDIR}/test.log &
PID_REDIS=$!
echo ${PID_REDIS} > ${BASEDIR}/redis.pid
echo "Preparing the environment"
cd ${BASEDIR}/test/support; sh prepare_db.sh || die "database preparation failure"; cd -
fi
PATH=node_modules/.bin/:$PATH PATH=node_modules/.bin/:$PATH
echo "Running tests" echo "Running tests"
mocha -u tdd \ mocha -u tdd ${TESTS}
test/unit/cartodb/redis_pool.test.js \
test/unit/cartodb/req2params.test.js \
test/acceptance/cache_validator.js \
test/acceptance/server.js
cleanup cleanup