Skip to content
This repository has been archived by the owner on Apr 25, 2022. It is now read-only.

Commit

Permalink
Add logic to run smoketests locally
Browse files Browse the repository at this point in the history
Closes #81
  • Loading branch information
razzeee committed Dec 3, 2021
1 parent 6d9e37e commit 1c39ee1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Dockerfile.smoketests
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.10-slim

COPY ./requirements.txt /requirements.txt
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential flatpak gir1.2-ostree-1.0 libcairo2-dev libgirepository1.0-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
pip install -r requirements.txt && \
flatpak --user remote-add flathub https://flathub.org/repo/flathub.flatpakrepo && \
flatpak --user remote-add flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo

COPY ./app /app
COPY ./data /data
COPY ./tests /tests
RUN pip install pytest

COPY smoketests.sh /smoketests.sh
RUN ["chmod", "+x", "/smoketests.sh"]
ENTRYPOINT ["/smoketests.sh"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ https://localhost:8000/docs
### Accessing redis
You can use a redis tool of your choice to interact with the database.
Just connect to localhost:6379.

### Running the smoketests locally
If you want to run the smoketests locally, you can use the following commands:
```bash
docker-compose run smoketests
```
You might need to flush your redis database before running the tests. As it assumes that the database is empty.
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ services:
- /var/lib/flatpak
- ./app:/app
- ./data:/data

smoketests:
build:
dockerfile: Dockerfile.smoketests
context: .
environment:
- REDIS_HOST=redis
links:
- redis:redis
4 changes: 4 additions & 0 deletions smoketests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

uvicorn app.main:app --host 0.0.0.0 &
python -m pytest -s tests/main.py

0 comments on commit 1c39ee1

Please sign in to comment.