Skip to content

Commit

Permalink
Draft: Run tests locally in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
artem.golovin committed Jun 29, 2024
1 parent f91dfd6 commit da6cfe3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:latest

COPY ./alembic_postgresql_enum ./alembic_postgresql_enum
COPY ./tests ./tests

WORKDIR ./tests

RUN pip install -r requirements.txt

ENTRYPOINT pytest
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3.8"

services:
run-tests:
# entrypoint: pytest
build: .
stdin_open: true
tty: true
command:
- pytest
environment:
DATABASE_URI: postgresql://test_user:test_password@db:5432/test_db
depends_on:
- db
links:
- "db:database"
db:
image: postgres:12
environment:
POSTGRES_DB: "test_db"
POSTGRES_USER: "test_user"
POSTGRES_PASSWORD: "test_password"
PGUSER: "postgres"

ports:
- "5432:5432"
volumes:
- ./api/db/postgres-test-data:/var/lib/postgresql/data
8 changes: 8 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ pip install -R tests/requirements.txt
Run tests
```
pytest
```

# In progress

To run tests just use:
```commandline
docker compose build
docker compose up
```

0 comments on commit da6cfe3

Please sign in to comment.