feat: Add E2E MCP test suite and CI/CD automation #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Tests - AgentGateway + PII Server | ||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| workflow_dispatch: # Manual trigger | ||
| schedule: | ||
| # Run tests daily at 6 AM UTC | ||
| - cron: '0 6 * * *' | ||
| env: | ||
| GATEWAY_URL: https://unitone-agentgateway.whitecliff-a0c9f0f7.eastus2.azurecontainerapps.io | ||
| AZURE_RESOURCE_GROUP: mcp-gateway-dev-rg | ||
| jobs: | ||
| e2e-tests: | ||
| name: Run E2E Tests | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| cache: 'pip' | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r tests/requirements-e2e.txt | ||
| - name: Run E2E Tests | ||
| run: | | ||
| python tests/e2e_mcp_pii_test.py | ||
| env: | ||
| GATEWAY_URL: ${{ env.GATEWAY_URL }} | ||
| - name: Run Security Guards Tests | ||
| run: | | ||
| python tests/test_security_guards.py | ||
| continue-on-error: true # Don't fail the build if security guards aren't implemented yet | ||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: e2e-test-results | ||
| path: | | ||
| tests/*.log | ||
| tests/*.xml | ||
| retention-days: 30 | ||
| health-check: | ||
| name: Service Health Checks | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - name: Check AgentGateway Health | ||
| run: | | ||
| response=$(curl -s -o /dev/null -w "%{http_code}" \ | ||
| ${{ env.GATEWAY_URL }}/ui) | ||
| if [ "$response" = "401" ] || [ "$response" = "200" ]; then | ||
| echo "✓ AgentGateway is healthy (HTTP $response)" | ||
| else | ||
| echo "✗ AgentGateway returned unexpected status: $response" | ||
| exit 1 | ||
| fi | ||
| - name: Azure Login | ||
| uses: azure/login@v2 | ||
| with: | ||
| creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
| if: secrets.AZURE_CREDENTIALS != '' | ||
| continue-on-error: true | ||
| - name: Check PII Server Logs | ||
| if: steps.azure-login.outcome == 'success' | ||
| run: | | ||
| az containerapp logs show \ | ||
| --name mcp-pii-test-server \ | ||
| --resource-group ${{ env.AZURE_RESOURCE_GROUP }} \ | ||
| --tail 10 | ||
| continue-on-error: true | ||
| notify: | ||
| name: Notify Results | ||
| needs: [e2e-tests, health-check] | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
| steps: | ||
| - name: Send notification | ||
| run: | | ||
| if [ "${{ needs.e2e-tests.result }}" = "success" ]; then | ||
| echo "✓ E2E tests passed" | ||
| else | ||
| echo "✗ E2E tests failed" | ||
| fi | ||
| # Add Slack/Teams/Email notification here if needed | ||