download redis-cell lib during tests

This commit is contained in:
Simon Martín 2018-03-15 11:35:38 +01:00
parent 60bf81d950
commit 54f113ab5f
2 changed files with 18 additions and 0 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ redis.pid
*.log
coverage/
.DS_Store
libredis_cell.so

View File

@ -6,6 +6,7 @@ OPT_DROP_REDIS=yes # drop the redis test environment
OPT_DROP_PGSQL=yes # drop the PostgreSQL test environment
OPT_COVERAGE=no # run tests with coverage
OPT_DOWNLOAD_SQL=yes # download a fresh copy of sql files
OPT_REDIS_CELL=yes # download redis cell
export PGAPPNAME=cartodb_tiler_tester
@ -49,6 +50,16 @@ die() {
exit 1
}
get_redis_cell() {
if test x"$OPT_REDIS_CELL" = xyes; then
echo "Downloading redis-cell"
wget https://github.com/brandur/redis-cell/releases/download/v0.2.2/redis-cell-v0.2.2-x86_64-unknown-linux-gnu.tar.gz > /dev/null 2>&1
tar xvzf redis-cell-v0.2.2-x86_64-unknown-linux-gnu.tar.gz > /dev/null 2>&1
rm redis-cell-v0.2.2-x86_64-unknown-linux-gnu.tar.gz
rm libredis_cell.d
fi
}
trap 'cleanup_and_exit' 1 2 3 5 9 13
while [ -n "$1" ]; do
@ -88,6 +99,10 @@ while [ -n "$1" ]; do
OPT_CREATE_PGSQL=no
shift
continue
elif test "$1" = "--norediscell"; then
OPT_REDIS_CELL=no
shift
continue
else
break
fi
@ -99,12 +114,14 @@ if [ -z "$1" ]; then
echo " --nocreate do not create the test environment on start" >&2
echo " --nodrop do not drop the test environment on exit" >&2
echo " --with-coverage use istanbul to determine code coverage" >&2
echo " --norediscell do not download redis-cell" >&2
exit 1
fi
TESTS=$@
if test x"$OPT_CREATE_REDIS" = xyes; then
get_redis_cell
echo "Starting redis on port ${REDIS_PORT}"
echo "port ${REDIS_PORT}" | redis-server - --loadmodule ./libredis_cell.so > ${BASEDIR}/test.log &
PID_REDIS=$!