Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mypy
pip install -r backend/requirements.txt
pip install -r backend/requirements-dev.txt
- name: Run mypy
env:
SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
run: mypy --config-file backend/pyproject.toml backend/
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ jobs:
# For the backend service
yq eval '.services.backend.extra_hosts += ["host.docker.internal:host-gateway"]' -i docker-compose.ci.yaml
yq eval '.services.backend.environment += ["TESTING=true"]' -i docker-compose.ci.yaml
yq eval '.services.backend.environment += ["MONGO_ROOT_USER=testroot"]' -i docker-compose.ci.yaml
yq eval '.services.backend.environment += ["MONGO_ROOT_PASSWORD=testpassword"]' -i docker-compose.ci.yaml
# Disable OpenTelemetry SDK during tests to avoid exporter retries
yq eval '.services.backend.environment += ["OTEL_SDK_DISABLED=true"]' -i docker-compose.ci.yaml

# For the mongo service
yq eval '.services.mongo.environment += ["MONGO_ROOT_USER=testroot"]' -i docker-compose.ci.yaml
yq eval '.services.mongo.environment += ["MONGO_ROOT_PASSWORD=testpassword"]' -i docker-compose.ci.yaml

# For the cert-generator service
yq eval '.services.cert-generator.extra_hosts += ["host.docker.internal:host-gateway"]' -i docker-compose.ci.yaml
Expand Down Expand Up @@ -75,15 +83,15 @@ jobs:

- name: Wait for backend to be healthy
run: |
timeout 300 bash -c 'until curl -k https://localhost:443/api/v1/health -o /dev/null; do \
timeout 300 bash -c 'until curl -k https://127.0.0.1:443/api/v1/health -o /dev/null; do \
echo "Retrying backend health check..."; \
sleep 5; \
done'
echo "Backend is healthy!"
Comment on lines +86 to 90

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Health check should fail on HTTP errors.

Without -f, curl exits 0 on 5xx, masking failures.

-          timeout 300 bash -c 'until curl -k https://127.0.0.1:443/api/v1/health -o /dev/null; do \
+          timeout 300 bash -c 'until curl -fsSk https://127.0.0.1:443/api/v1/health -o /dev/null; do \
             echo "Retrying backend health check..."; \
             sleep 5; \
           done'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
timeout 300 bash -c 'until curl -k https://127.0.0.1:443/api/v1/health -o /dev/null; do \
echo "Retrying backend health check..."; \
sleep 5; \
done'
echo "Backend is healthy!"
timeout 300 bash -c 'until curl -fsSk https://127.0.0.1:443/api/v1/health -o /dev/null; do \
echo "Retrying backend health check..."; \
sleep 5; \
done'
echo "Backend is healthy!"
🤖 Prompt for AI Agents
.github/workflows/tests.yml around lines 86 to 90: the health-check uses curl
without --fail so HTTP 5xx responses still exit 0 and mask backend failures; fix
by adding curl's --fail (or -f) flag and optionally --show-error/--silent to
preserve useful output, so the loop will only succeed on 2xx responses and the
job will fail on HTTP errors.


- name: Wait for frontend to be ready
run: |
timeout 120 bash -c 'until curl -k https://localhost:5001 -o /dev/null; do \
timeout 120 bash -c 'until curl -k https://127.0.0.1:5001 -o /dev/null; do \
echo "Retrying frontend check..."; \
sleep 5; \
done'
Expand All @@ -100,7 +108,7 @@ jobs:
- name: Set up Python for Tests
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.12'

- name: Install Python test dependencies
run: |
Expand All @@ -111,8 +119,11 @@ jobs:
pip3 install -r requirements-dev.txt

- name: Run backend tests with coverage
env:
BACKEND_BASE_URL: https://127.0.0.1:443
run: |
cd backend
echo "Using BACKEND_BASE_URL=$BACKEND_BASE_URL"
python -m pytest tests/integration tests/unit -v --cov=app --cov-report=xml --cov-report=term

- name: Upload coverage to Codecov
Expand Down Expand Up @@ -143,4 +154,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: integration-test-logs
path: logs/
path: logs/
Loading
Loading