From 5d6b1ed2a21d150ca4bf04fc77bda13c3596e884 Mon Sep 17 00:00:00 2001 From: Joel Davies Date: Wed, 25 Sep 2024 10:12:46 +0000 Subject: [PATCH] Add e2e tests to CI #11 --- .github/workflows/.ci.yml | 32 ++++++++++++++++++++++++++++++++ test/mock_data.py | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/.ci.yml b/.github/workflows/.ci.yml index 39e3687..71d9978 100644 --- a/.github/workflows/.ci.yml +++ b/.github/workflows/.ci.yml @@ -55,3 +55,35 @@ jobs: - name: Run unit tests run: pytest -c test/pytest.ini test/unit/ --cov + + e2e-tests: + needs: [unit-tests] + name: End-to-End Tests + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Set up Python + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + with: + python-version: "3.12" + cache: "pip" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[test] + python -m pip install -r requirements.txt + + - name: Create logging configuration file + run: cp object_storage_api/logging.example.ini object_storage_api/logging.ini + + # Sleep 10 seconds to give time for containers to start and for the buckets to be created + - name: Start MongoDB and MinIO + run: | + docker compose up -d mongo-db minio minio_create_buckets + sleep 10 + + - name: Run e2e tests + run: pytest -c test/pytest.ini test/e2e/ --cov diff --git a/test/mock_data.py b/test/mock_data.py index 0388ae2..deeaf77 100644 --- a/test/mock_data.py +++ b/test/mock_data.py @@ -26,7 +26,7 @@ ATTACHMENT_POST_DATA_REQUIRED_VALUES_ONLY = { "entity_id": str(ObjectId()), - "file_name": "report.pdf", + "file_name": "report.txt", } ATTACHMENT_POST_RESPONSE_DATA_REQUIRED_VALUES_ONLY = { @@ -42,7 +42,7 @@ ATTACHMENT_POST_DATA_ALL_VALUES = { "entity_id": str(ObjectId()), - "file_name": "report.pdf", + "file_name": "report.txt", "title": "Report Title", "description": "A damage report.", }