diff --git a/.gitea/workflows/tests.yaml b/.gitea/workflows/tests.yaml index 3f07f9e..ce877d8 100644 --- a/.gitea/workflows/tests.yaml +++ b/.gitea/workflows/tests.yaml @@ -49,12 +49,28 @@ jobs: working-directory: IoT-Systems run: docker-compose down -v --remove-orphans + mapview-test: + name: MapView testing + runs-on: host-arch-x86_64 + steps: + - name: Clone repository + run: git clone --revision ${{ gitea.sha }} --depth 1 ${{ gitea.server_url }}/${{ gitea.repository }} + + - name: Build MapView testing container + working-directory: IoT-Systems + run: docker build -t local/mapview/${{gitea.sha}} -f MapView/Dockerfile-test . + + - name: Run MapView tests + working-directory: IoT-Systems + run: docker run --rm -it -v $PWD/MapView:/app:ro local/mapview/${{gitea.sha}} + integration-smoke-test: name: Integration smoke testing runs-on: host-arch-x86_64 needs: - hub-test - store-test + - mapview-test steps: - name: Clone repository run: git clone --revision ${{ gitea.sha }} --depth 1 ${{ gitea.server_url }}/${{ gitea.repository }} diff --git a/MapView/Dockerfile-test b/MapView/Dockerfile-test new file mode 100644 index 0000000..883af29 --- /dev/null +++ b/MapView/Dockerfile-test @@ -0,0 +1,14 @@ +# Use the official Python image as the base image +FROM python:latest +# Set the working directory inside the container +WORKDIR /app +# Copy the requirements.txt file and install dependencies +COPY MapView/requirements.txt . +RUN sed -i 's/==.*//' requirements.txt + +RUN apt update && apt install -y libgl-dev libsdl1.2-dev + +RUN pip install --no-cache-dir -r requirements.txt +RUN pip install --root-user-action ignore --no-cache-dir python-unittest kivy[base] pygame + +CMD ["./test-entry.sh"] diff --git a/MapView/test-entry.sh b/MapView/test-entry.sh new file mode 100755 index 0000000..1f26b56 --- /dev/null +++ b/MapView/test-entry.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +PYTHONPATH=$PWD python3 -m unittest tests.test_mp diff --git a/MapView/tests/test_mp.py b/MapView/tests/test_mp.py index fab62f5..e901925 100644 --- a/MapView/tests/test_mp.py +++ b/MapView/tests/test_mp.py @@ -6,8 +6,8 @@ sys.modules['lineMapLayer'] = Mock() sys.modules['datasource'] = Mock() sys.modules['config'] = Mock() -from MapView.main import get_lat_lon, MapViewApp -from MapView.datasource import Datasource as DataSourceClass +from main import get_lat_lon, MapViewApp +from datasource import Datasource as DataSourceClass # ----------------------- @@ -89,4 +89,4 @@ class TestMapLatLonToProcessedAgentData(unittest.TestCase): if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main()