Docker - add commands for lint and tests

This commit is contained in:
Sam 2022-07-20 10:08:01 +02:00
parent 721937e425
commit 6dffecb9bb
9 changed files with 53 additions and 6 deletions

View File

@ -55,6 +55,13 @@ docker-init: docker-init-db docker-restart docker-run-workers
docker-init-db:
docker-compose -f docker-compose-dev.yml exec fittrackee docker/init-database.sh
docker-lint-client:
docker-compose -f docker-compose-dev.yml up -d fittrackee_client
docker-compose -f docker-compose-dev.yml exec fittrackee_client yarn lint
docker-lint-python: docker-run
docker-compose -f docker-compose-dev.yml exec fittrackee docker/lint-python.sh
docker-logs:
docker-compose -f docker-compose-dev.yml logs --follow
@ -85,6 +92,18 @@ docker-shell:
docker-stop:
docker-compose -f docker-compose-dev.yml stop
docker-test-client:
docker-compose -f docker-compose-dev.yml up -d fittrackee_client
docker-compose -f docker-compose-dev.yml exec fittrackee_client yarn test:unit
# needs a running application
docker-test-e2e: docker-run
docker-compose -f docker-compose-dev.yml up -d selenium
docker-compose -f docker-compose-dev.yml exec fittrackee docker/test-e2e.sh $(PYTEST_ARGS)
docker-test-python: docker-run
docker-compose -f docker-compose-dev.yml exec fittrackee docker/test-python.sh $(PYTEST_ARGS)
docker-up:
docker-compose -f docker-compose-dev.yml up fittrackee
@ -184,11 +203,11 @@ set-admin:
echo "Deprecated command, will be removed in a next version. Use 'user-set-admin' instead."
$(FTCLI) users update $(USERNAME) --set-admin true
test-all: test-client test-python
test-e2e:
$(PYTEST) e2e --driver firefox $(PYTEST_ARGS)
test-all: test-client test-python
test-e2e-client:
E2E_ARGS=client $(PYTEST) e2e --driver firefox $(PYTEST_ARGS)

View File

@ -64,3 +64,9 @@ services:
ports:
- "1025:1025"
- "8025:8025"
selenium:
image: selenium/standalone-firefox:latest
hostname: selenium
privileged: true
shm_size: 2g

View File

@ -2,7 +2,7 @@
set -e
cd /usr/src/app
source .env.docker
source .env
ftcli db drop
ftcli db upgrade

7
docker/lint-python.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
cd /usr/src/app
source .env
pytest --flake8 --isort --black -m "flake8 or isort or black" fittrackee e2e --ignore=fittrackee/migrations

View File

@ -2,6 +2,6 @@
set -e
cd /usr/src/app
source .env.docker
source .env
flask worker --processes=$WORKERS_PROCESSES >> dramatiq.log 2>&1

View File

@ -2,6 +2,6 @@
set -e
cd /usr/src/app
source .env.docker
source .env
ftcli users update $1 --set-admin true

View File

@ -2,6 +2,6 @@
set -e
cd /usr/src/app
source .env.docker
source .env
/bin/bash

8
docker/test-e2e.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
set -e
cd /usr/src/app
source .env
export TEST_APP_URL=http://$(hostname --ip-address):5000
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 $*

7
docker/test-python.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
cd /usr/src/app
source .env
pytest fittrackee $*