diff --git a/Dockerfile.smoketests b/Dockerfile.smoketests new file mode 100644 index 0000000..1d13800 --- /dev/null +++ b/Dockerfile.smoketests @@ -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"] diff --git a/README.md b/README.md index 5acf825..5ab3121 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1dd792e..70b2862 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/smoketests.sh b/smoketests.sh new file mode 100644 index 0000000..c80503a --- /dev/null +++ b/smoketests.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +uvicorn app.main:app --host 0.0.0.0 & +python -m pytest -s tests/main.py \ No newline at end of file