Skip to content

update tests

update tests #53

Workflow file for this run

name: CI - Build and Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd mcp_server
pip install -e .[test]
- name: Build Docker images
run: |
cd auth_platform
docker compose build
- name: Start services
run: |
cd auth_platform
docker compose up -d
- name: Wait for services to be ready
run: |
echo "Waiting for services to start..."
sleep 10
# Wait for MCP Server
for i in {1..30}; do
if curl -f http://localhost:8001/health > /dev/null 2>&1; then
echo "✓ MCP Server is ready"
break
fi
echo "Waiting for MCP Server... ($i/30)"
sleep 2
done
# Wait for Auth Service
for i in {1..30}; do
if curl -f http://localhost:8000/docs > /dev/null 2>&1; then
echo "✓ Auth Service is ready"
break
fi
echo "Waiting for Auth Service... ($i/30)"
sleep 2
done
- name: Check service health
run: |
echo "=== MCP Server Health ==="
curl -f http://localhost:8001/health || exit 1
echo -e "\n=== Auth Service Health ==="
curl -f http://localhost:8000/docs || exit 1
- name: Run MCP Server unit tests
run: |
cd mcp_server
pytest tests/unit/test_fraud_detector.py -v
- name: Run end-to-end tests
run: |
cd mcp_server
pytest tests/e2e/test_e2e_simple.py -v -s --log-cli-level=INFO
- name: Show service logs on failure
if: failure()
run: |
echo "=== MCP Server Logs ==="
docker logs $(docker ps -aq --filter "name=mcp-server") || echo "MCP Server container not found"
echo -e "\n=== Auth Service Logs ==="
docker logs $(docker ps -aq --filter "name=auth-service") || echo "Auth Service container not found"
- name: Stop services
if: always()
run: |
cd auth_platform
docker compose down -v