🚚 Move location of scripts to simplify file structure (#1352)
This commit is contained in:

committed by
GitHub

parent
68a7fe0899
commit
87254dd79e
@@ -17,14 +17,10 @@ RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; els
|
||||
|
||||
ENV PYTHONPATH=/app
|
||||
|
||||
COPY ./scripts/ /app/
|
||||
COPY ./scripts /app/scripts
|
||||
|
||||
COPY ./alembic.ini /app/
|
||||
|
||||
COPY ./prestart.sh /app/
|
||||
|
||||
COPY ./tests-start.sh /app/
|
||||
|
||||
COPY ./app /app/app
|
||||
|
||||
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]
|
||||
|
@@ -106,15 +106,15 @@ If you use GitHub Actions the tests will run automatically.
|
||||
If your stack is already up and you just want to run the tests, you can use:
|
||||
|
||||
```bash
|
||||
docker compose exec backend bash /app/tests-start.sh
|
||||
docker compose exec backend bash scripts/tests-start.sh
|
||||
```
|
||||
|
||||
That `/app/tests-start.sh` script just calls `pytest` after making sure that the rest of the stack is running. If you need to pass extra arguments to `pytest`, you can pass them to that command and they will be forwarded.
|
||||
That `/app/scripts/tests-start.sh` script just calls `pytest` after making sure that the rest of the stack is running. If you need to pass extra arguments to `pytest`, you can pass them to that command and they will be forwarded.
|
||||
|
||||
For example, to stop on first error:
|
||||
|
||||
```bash
|
||||
docker compose exec backend bash /app/tests-start.sh -x
|
||||
docker compose exec backend bash scripts/tests-start.sh -x
|
||||
```
|
||||
|
||||
### Test Coverage
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Let the DB start
|
||||
python /app/app/backend_pre_start.py
|
||||
python app/backend_pre_start.py
|
||||
|
||||
# Run migrations
|
||||
alembic upgrade head
|
||||
|
||||
# Create initial data in DB
|
||||
python /app/app/initial_data.py
|
||||
python app/initial_data.py
|
7
backend/scripts/tests-start.sh
Normal file
7
backend/scripts/tests-start.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
python app/tests_pre_start.py
|
||||
|
||||
bash scripts/test.sh "$@"
|
@@ -1,7 +0,0 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
python /app/app/tests_pre_start.py
|
||||
|
||||
bash ./scripts/test.sh "$@"
|
Reference in New Issue
Block a user