Skip to content

Commit

Permalink
Add tests entry point to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
arikfr committed Jan 22, 2017
1 parent c82a01b commit 7cc97fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ help() {
echo "create_db -- create database tables"
}

tests() {
export REDASH_DATABASE_URL="postgresql://postgres@postgres/tests"
exec sudo -E -u redash make test
}

case "$1" in
worker)
shift
Expand All @@ -59,6 +64,9 @@ case "$1" in
create_db)
exec sudo -E -u redash /app/manage.py database create_tables
;;
tests)
tests
;;
*)
help
;;
Expand Down
4 changes: 2 additions & 2 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from unittest import TestCase
from contextlib import contextmanager

os.environ['REDASH_REDIS_URL'] = "redis://localhost:6379/5"
os.environ['REDASH_REDIS_URL'] = os.environ.get('REDASH_REDIS_URL', "redis://localhost:6379/0").replace("/0", "/5")
# Use different url for Celery to avoid DB being cleaned up:
os.environ['REDASH_CELERY_BROKER'] = "redis://localhost:6379/6"
os.environ['REDASH_CELERY_BROKER'] = os.environ.get('REDASH_REDIS_URL', "redis://localhost:6379/0").replace("/5", "/6")

# Dummy values for oauth login
os.environ['REDASH_GOOGLE_CLIENT_ID'] = "dummy"
Expand Down

0 comments on commit 7cc97fa

Please sign in to comment.