diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce6a484..ee098ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,6 +71,7 @@ jobs: projectName: aimingmed-ai image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]') testContainerName: tests-aimingmedai + # Todos: This part is not working the testEnvs is not being taken up corrrectly by Run Tests # Pass test environment variables as JSON string testEnvs: > '[ @@ -79,6 +80,7 @@ jobs: "ENVIRONMENT=dev", "TESTING=1", ]' + # Todos: This part is not working the testEnvs is not being taken up corrrectly by Run Tests # Pass test directories as JSON string tests: > '[ @@ -90,6 +92,7 @@ jobs: [ { "name": "backend-aimingmedai", + "ports" : ["8004:80"], "env": { "ENVIRONMENT": "dev", "TESTING": "1", @@ -100,6 +103,7 @@ jobs: }, { "name": "frontend-aimingmedai", + "ports" : ["3004:80"], "depends_on": ["backend-aimingmedai"], "env": { "ENVIRONMENT": "dev", diff --git a/.github/workflows/template_test.yml b/.github/workflows/template_test.yml index dd23217..3545db7 100644 --- a/.github/workflows/template_test.yml +++ b/.github/workflows/template_test.yml @@ -97,6 +97,7 @@ jobs: foreach ($img in $images) { $serviceName = $img.name $svc = @{} + $svc.container_name = $serviceName $svc.image = "${{ steps.tags.outputs.image_repo_path }}/$($serviceName):${{ env.TAG }}" # Use run_id tag if ($img.depends_on) { @@ -108,6 +109,9 @@ jobs: $svc.environment = @{} } $svc.networks = @("test") # Assign service to the custom network + if ($img.ports) { + $svc.ports = $img.ports + } $compose.services.$serviceName = $svc } @@ -143,11 +147,17 @@ jobs: echo "Compose logs after wait:" docker compose -f "${{ steps.create_compose.outputs.COMPOSE_FILE_PATH }}" logs + - name: Check Docker Services Health + run: | + echo "Checking health of Docker services..." + # Check if all services are healthy + docker compose -f "${{ steps.create_compose.outputs.COMPOSE_FILE_PATH }}" ps + - name: Run Tests shell: bash run: | TEST_DIRS='["tests/integration/backend"]' - TEST_ENVS_JSON='["FRONTEND_URL=http://frontend:80","BACKEND_URL=http://backend:80","ENVIRONMENT=dev","TESTING=1"]' + TEST_ENVS_JSON='["ENVIRONMENT=dev","TESTING=1"]' RESULTS_PATH="${{ inputs.testResultsPath }}" STAGING_DIR="${{ runner.temp }}/test-results" # Use runner temp dir for results mkdir -p "$STAGING_DIR" diff --git a/app/backend/Dockerfile.prod b/app/backend/Dockerfile.prod index 0b425b5..0553b8a 100644 --- a/app/backend/Dockerfile.prod +++ b/app/backend/Dockerfile.prod @@ -13,8 +13,6 @@ ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV ENVIRONMENT=dev ENV TESTING=1 -ENV DEEPSEEK_API_KEY=sk-XXXXXXXXXX -ENV TAVILY_API_KEY=tvly-dev-wXXXXXX # install python dependencies RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv && rm -rf ~/.cache/pip diff --git a/app/tests/tests/integration/backend/test_frontend_backend.py b/app/tests/tests/integration/backend/test_frontend_backend.py index 42563b8..b4e8613 100644 --- a/app/tests/tests/integration/backend/test_frontend_backend.py +++ b/app/tests/tests/integration/backend/test_frontend_backend.py @@ -1,17 +1,12 @@ import pytest -import subprocess -import requests import json -import time -import os -import asyncio import websockets @pytest.mark.asyncio async def test_chatbot_integration(): # Send a request to the chatbot endpoint - url = "ws://backend-aimingmedai:80/ws" + url = "ws://localhost:8004/ws" data = [{"content": "Hello"}] try: async with websockets.connect(url) as websocket: