Skip to content

Commit

Permalink
Improve test file to allow building of images and cleanup of volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
alastair committed Apr 20, 2020
1 parent 900c983 commit 86960c4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# ./test.sh bring up, make database, test, bring down
# for development:
# ./test.sh -b run docker-compose build
# ./test.sh -u bring up background and load database if needed
# ./test.sh [params] run tests, passing optional params to inner test
# ./test.sh -s stop test containers without removing
Expand Down Expand Up @@ -40,7 +41,7 @@ function setup {
echo "Running setup"
# PostgreSQL Database initialization
docker-compose -f $COMPOSE_FILE_LOC -p $COMPOSE_PROJECT_NAME run --rm acousticbrainz dockerize -wait tcp://db:5432 -timeout 60s \
bash -c "python manage.py init_db"
bash -c "python manage.py init_db --force"
}

function is_db_running {
Expand Down Expand Up @@ -77,12 +78,19 @@ function dcdown {
docker-compose -f $COMPOSE_FILE_LOC \
-p $COMPOSE_PROJECT_NAME \
down
docker volume rm -f acousticbrainztest_postgres
}

# Exit immediately if a command exits with a non-zero status.
# set -e
#trap cleanup EXIT # Cleanup after tests finish running

if [ "$1" == "-b" ]; then
echo "Building containers"
build
exit 0
fi

if [ "$1" == "-s" ]; then
echo "Stopping containers"
stop
Expand Down

0 comments on commit 86960c4

Please sign in to comment.