Skip to content
Snippets Groups Projects
Commit b4f9c100 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Speed up local tests on OSX

Using a volume for postgres data makes the tests very slow on OSX.
When running the tests, there is no need to persist the data (db is
recreated before each session).

`make db_test` should be used to start postgres without mounting the data
volume (skip the docker-compose.override.yml).
parent aaf3a36c
No related branches found
No related tags found
No related merge requests found
...@@ -15,3 +15,4 @@ junit.xml ...@@ -15,3 +15,4 @@ junit.xml
/app/static/files/* /app/static/files/*
!/app/static/files/.empty !/app/static/files/.empty
.vscode .vscode
.mypy_cache
...@@ -50,9 +50,9 @@ upgrade_db: ## upgrade the dev database ...@@ -50,9 +50,9 @@ upgrade_db: ## upgrade the dev database
test: ## run the tests (on current directory) test: ## run the tests (on current directory)
docker-compose run --rm web pytest --cov=app -v docker-compose run --rm web pytest --cov=app -v
db_image: ## start postgres and redis to test the latest image db_test: ## start required containers for test
# Pass docker-compose.yml to skip docker-compose.override.yml # Pass docker-compose.yml to skip docker-compose.override.yml (db not mounted as volume for speed)
docker-compose -f docker-compose.yml up -d postgres redis docker-compose -f docker-compose.yml up -d postgres redis elasticsearch worker
test_image: ## run the tests (on the latest image) test_image: ## run the tests (on the latest image)
# Pass docker-compose.yml to skip docker-compose.override.yml # Pass docker-compose.yml to skip docker-compose.override.yml
......
...@@ -12,8 +12,6 @@ services: ...@@ -12,8 +12,6 @@ services:
command: flask run --host 0.0.0.0 --port 8000 command: flask run --host 0.0.0.0 --port 8000
ports: ports:
- "8000:8000" - "8000:8000"
volumes:
- .:/app
worker: worker:
environment: environment:
LOCAL_SETTINGS: /app/settings.cfg LOCAL_SETTINGS: /app/settings.cfg
......
...@@ -8,6 +8,8 @@ services: ...@@ -8,6 +8,8 @@ services:
- postgres - postgres
- redis - redis
- elasticsearch - elasticsearch
volumes:
- .:/app
worker: worker:
image: registry.esss.lu.se/ics-infrastructure/csentry:master image: registry.esss.lu.se/ics-infrastructure/csentry:master
container_name: csentry_worker container_name: csentry_worker
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment