mirror of
https://github.com/aimingmed/aimingmed-ai.git
synced 2026-01-19 13:23:23 +08:00
Merge pull request #64 from aimingmed/feature/backend-frontend-structure
Feature/backend frontend structure
This commit is contained in:
commit
e18baeff79
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -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",
|
||||
|
||||
12
.github/workflows/template_test.yml
vendored
12
.github/workflows/template_test.yml
vendored
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user