This commit is contained in:
leehk 2025-04-18 07:07:15 +08:00
parent 19a8c7e7ae
commit 5aa717aff7
3 changed files with 10 additions and 7 deletions

View File

@ -92,6 +92,7 @@ jobs:
[
{
"name": "backend-aimingmedai",
"ports" : ["8004:80"],
"env": {
"ENVIRONMENT": "dev",
"TESTING": "1",
@ -102,6 +103,7 @@ jobs:
},
{
"name": "frontend-aimingmedai",
"ports" : ["3004:80"],
"depends_on": ["backend-aimingmedai"],
"env": {
"ENVIRONMENT": "dev",

View File

@ -109,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
}
@ -154,7 +157,7 @@ jobs:
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"

View File

@ -1,17 +1,15 @@
import pytest
import subprocess
import requests
import json
import time
import os
import asyncio
import websockets
import os
backend_host = os.getenv("BACKEND_URL", "backend-aimingmedai")
@pytest.mark.asyncio
async def test_chatbot_integration():
# Send a request to the chatbot endpoint
url = "ws://backend-aimingmedai:80/ws"
url = f"ws://{backend_host}:80/ws"
data = [{"content": "Hello"}]
try:
async with websockets.connect(url) as websocket: