-
Notifications
You must be signed in to change notification settings - Fork 1
Fix GitHub Action hanging on SSE endpoint health check #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: MiguelElGallo <[email protected]>
Co-authored-by: MiguelElGallo <[email protected]>
I had to cancel the run, because the github action got stuck here: Run echo "Waiting for server to start..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to cancel the github actions because it got stuck here:
Run echo "Waiting for server to start..."
Waiting for server to start...
I had to cancel the github actions because it got stuck here: Run echo "Waiting for server to start..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive GitHub Actions workflow for automated end-to-end testing of the FastMCP application. The workflow validates all critical application functionality including server startup, endpoint accessibility, MCP protocol compliance, and load handling.
Key changes:
- Implements automated CI/CD testing triggered on pushes and pull requests
- Tests core server functionality, MCP tools, and SSE endpoint behavior
- Includes load testing and proper cleanup procedures
.github/workflows/e2e-test.yml
Outdated
echo "Testing MCP tool and resource availability..." | ||
cd src | ||
python -c 'import app; result = app.add(2, 3); print("Add function works:", result == 5)' | ||
python -c 'import app; greeting = app.get_greeting("Test"); print("Greeting function works:", greeting == "Hello, Test!")' |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direct function call to app.get_greeting
bypasses the MCP protocol layer. This tests the Python function directly but not the MCP resource functionality. Consider testing the resource through the MCP URI pattern greeting://Test
.
python -c 'import app; greeting = app.get_greeting("Test"); print("Greeting function works:", greeting == "Hello, Test!")' | |
# Test MCP resource via protocol layer (not direct function call) | |
GREETING_RESPONSE=$(curl -s http://localhost:8000/resource/greeting://Test || echo "") | |
if [[ "$GREETING_RESPONSE" == "Hello, Test!" ]]; then | |
echo "Greeting resource works: true" | |
else | |
echo "Greeting resource works: false (response: $GREETING_RESPONSE)" | |
exit 1 | |
fi |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to cancel the github actions because it got stuck here:
Run echo "Waiting for server to start..."
Waiting for server to start...
- name: Wait for server to start | ||
run: | | ||
echo "Waiting for server to start..." | ||
for i in {1..30}; do | ||
if curl -s http://localhost:8000/sse > /dev/null; then | ||
echo "Server is ready!" | ||
break | ||
fi | ||
echo "Attempt $i: Server not ready yet, waiting..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The github actions hangs in this place, it never ends.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit c4a0822. The issue was that curl -s http://localhost:8000/sse
hangs on SSE endpoints since they maintain persistent connections. Updated the health check to use timeout 3s curl -s -I
with HTTP status code validation instead.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
1m 37s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot fix
Co-authored-by: MiguelElGallo <[email protected]>
Fixed the hanging issue in commit c4a0822. The problem was that the health check |
@copilot , github actions fails with: Run # Test MCP client connection to the SSE endpoint Test MCP client connection to the SSE endpointThis tests the core MCP functionality without needing a full MCP clientTest 1: Basic SSE connection with MCP headersecho "Testing MCP SSE connection..." Test 2: Verify server exposes expected MCP components via direct function callsecho "Testing MCP tool and resource availability..." |
Co-authored-by: MiguelElGallo <[email protected]>
Fixed the timeout issue in commit 96b4ede. The problem was that |
This PR fixes a critical issue where the GitHub Action workflow would hang indefinitely during the server health check step, preventing automated testing from completing.
Problem
The original workflow used
curl -s http://localhost:8000/sse > /dev/null
to check if the FastMCP server was ready. However, Server-Sent Events (SSE) endpoints maintain persistent connections, causing curl to hang waiting for event streams instead of simply verifying endpoint availability.Solution
Fixed Health Check Logic:
curl -s http://localhost:8000/sse > /dev/null
timeout 3s curl -s -I http://localhost:8000/sse | head -n 1 | grep -q "200 OK"
Fixed Timeout Handling:
bash -e
)set +e
/set -e
around timeout command to prevent premature script terminationSimplified MCP Testing:
/tools/add
(FastMCP doesn't expose tools this way)app.add(2, 3)
andapp.get_greeting("Test")
Root Cause
The workflow was failing because
bash -e
(exit on error) caused the script to exit immediately when thetimeout
command returned exit code 124, before the exit code could be properly captured and handled by the conditional logic.Test Coverage
The workflow now successfully tests:
The fix ensures reliable automated testing without hanging, providing confidence for future deployments.
Fixes #15.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.