Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 158 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,162 @@ on:
workflow_dispatch:
inputs:
commit-sha:
description: "Commit SHA to test against"
required: true
description: "Commit SHA to test against (defaults to current branch)"
required: false
type: string

permissions:
contents: read
packages: write

jobs:
run-integration-tests:
name: "Run Integration Tests - s000-hello-acp"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit-sha || github.ref }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull agent image
run: |
echo "🐳 Pulling agent image..."
docker pull ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest
echo "✅ Agent image pulled successfully"

- name: Start AgentEx services with host access
working-directory: ./agentex
run: |
echo "🚀 Starting AgentEx services with host access override..."
docker compose -f docker-compose.yml -f docker-compose.host-access.yml up -d
echo "⏳ Waiting for services to be ready..."
sleep 30
docker compose ps

- name: Run agent integration test
run: |
echo "🧪 Running integration test for agent: s000-hello-acp"
echo "🐳 Using image: ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest"

# Start the agent container

docker run -d --name agent-test-s000-hello-acp \
-e AGENT_NAME=s000-hello-acp \
-e ACP_URL=http://agent-test-s000-hello-acp:8000 \
-e ACP_PORT=8000 \
-e ACP_TYPE=sync \
-e AGENTEX_BASE_URL=http://agentex:5003 \
-e AGENTEX_API_BASE_URL=http://agentex:5003 \
-p 8000:8000 \
--network agentex-network \
ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest

echo "⏳ Waiting for agent to start..."
sleep 10

# Check for "Application startup complete" log message
echo "🔍 Waiting for 'Application startup complete' log message..."
TIMEOUT=60
ELAPSED=0

while [ $ELAPSED -lt $TIMEOUT ]; do
if docker logs agent-test-s000-hello-acp 2>&1 | grep -q "Application startup complete"; then
echo "✅ Agent application has started successfully"
break
fi

echo "⏳ Still waiting for startup... (${ELAPSED}s/${TIMEOUT}s)"
sleep 2
ELAPSED=$((ELAPSED + 2))
done

if [ $ELAPSED -ge $TIMEOUT ]; then
echo "❌ Timeout waiting for 'Application startup complete' message"
echo "📋 Container logs:"
docker logs agent-test-s000-hello-acp
exit 1
fi

- name: Run agent tests with retry
run: |
echo "🧪 Running pytest tests against the agent..."

echo "🔗 Testing connectivity from agentex container to agent..."
echo "📡 From agentex container, try to reach agent:"
docker exec agentex curl -v http://agent-test-s000-hello-acp:8000
echo "🏥 From agentex container, try to reach agent health endpoint:"
docker exec agentex curl -v http://agent-test-s000-hello-acp:8000/health

echo "🔗 Testing connectivity from agent container to agentex..."
echo "📡 From agent container, try to reach agentex:"
docker exec agent-test-s000-hello-acp curl -v http://agentex:5003
echo "🏥 From agent container, try to reach agentex health endpoint:"
docker exec agent-test-s000-hello-acp curl -v http://agentex:5003/health

echo "🔗 Testing basic network connectivity (ping)..."
echo "📍 Ping from agentex to agent:"
docker exec agentex ping -c 3 agent-test-s000-hello-acp
echo "📍 Ping from agent to agentex:"
docker exec agent-test-s000-hello-acp ping -c 3 agentex
MAX_ATTEMPTS=2
ATTEMPT=1
SUCCESS=false

while [ $ATTEMPT -le $MAX_ATTEMPTS ] && [ "$SUCCESS" = false ]; do
echo "📝 Test attempt $ATTEMPT/$MAX_ATTEMPTS"

if docker exec agent-test-s000-hello-acp pytest tests/test_agent.py -v; then
echo "✅ Tests passed on attempt $ATTEMPT!"
SUCCESS=true
else
echo "❌ Tests failed on attempt $ATTEMPT"
if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
echo "⏳ Waiting 5 seconds before retry..."
sleep 5
fi
fi

ATTEMPT=$((ATTEMPT + 1))
done

if [ "$SUCCESS" = false ]; then
echo "❌ All $MAX_ATTEMPTS test attempts failed"
exit 1
fi

echo "🎉 Agent tests completed successfully!"

- name: Show agent logs
if: always()
run: |
echo "📋 Agent logs for s000-hello-acp:"
docker logs agent-test-s000-hello-acp || echo "No logs available"

- name: Show AgentEx server logs
if: always()
run: |
echo "📋 AgentEx server logs:"
docker logs agentex || echo "No AgentEx server logs available"

- name: Cleanup agent container
if: always()
run: |
echo "🧹 Cleaning up agent container..."
docker stop agent-test-s000-hello-acp || true
docker rm agent-test-s000-hello-acp || true

- name: Cleanup services
if: always()
working-directory: ./agentex
run: |
echo "🧹 Cleaning up services..."
docker compose -f docker-compose.yml -f docker-compose.host-access.yml down
docker system prune -f
8 changes: 8 additions & 0 deletions agentex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ dev-wipe: ## Stop dev server and wipe DB
@echo "Stopping dev server and wiping DB"
docker compose down -v

dev-test: install-dev ## Start development server with host access for testing
@echo "🚀 Starting development server with host access for testing..."
docker compose -f docker-compose.yml -f docker-compose.host-access.yml up --build

dev-test-stop: ## Stop development server with host access configuration
@echo "Stopping dev test server with host access configuration"
docker compose -f docker-compose.yml -f docker-compose.host-access.yml down

# Database Commands
#

Expand Down
10 changes: 10 additions & 0 deletions agentex/docker-compose.host-access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# docker-compose.host-access.yml
# Override file to add host access when needed
# Usage: docker-compose -f docker-compose.yml -f docker-compose.host-access.yml up
# docker-compose.host-access.yml
services:
agentex:
networks:
agentex-network:
aliases:
- localhost # Make agentex reachable as localhost
Loading