Skip to content
Merged
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
77 changes: 14 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:

- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Run pre-commit
run: task pre-commit
Expand All @@ -39,6 +42,9 @@ jobs:

- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
Expand Down Expand Up @@ -68,66 +74,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v2

- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync

- name: Setup test configuration
run: |
# Ensure config.yaml exists and is properly configured for CI
if [ ! -f config.yaml ]; then
echo "Creating default config.yaml for CI"
cat > config.yaml << EOF
servers:
default:
default: true
url: "http://localhost:18080"
EOF
fi

- name: Verify test data
run: |
echo "Verifying test data structure..."
ls -la examples/basic/
ls -la examples/basic/events/
cat examples/basic/history-server.conf

- name: Start Spark History Server
run: |
echo "Starting Spark History Server with Docker..."
docker run -d \
--name spark-history-server \
-v $(pwd)/examples/basic:/mnt/data \
-p 18080:18080 \
docker.io/apache/spark:3.5.5 \
/opt/java/openjdk/bin/java \
-cp '/opt/spark/conf:/opt/spark/jars/*' \
-Xmx1g \
org.apache.spark.deploy.history.HistoryServer \
--properties-file /mnt/data/history-server.conf

- name: Wait for Spark History Server
run: |
timeout 60 bash -c 'until curl -f http://localhost:18080; do sleep 2; done'

- name: Test MCP Server startup
run: |
# Test import structure
uv run python -c "import app; print('✓ App imports successfully')"
uv run python -c "import main; print('✓ Main imports successfully')"

# Test MCP server can start (brief startup test)
timeout 10 uv run python main.py &
SERVER_PID=$!
sleep 5
kill $SERVER_PID 2>/dev/null || true
echo "✓ MCP Server startup test completed"

- name: Cleanup
if: always()
run: |
echo "Cleaning up Docker containers..."
docker stop spark-history-server 2>/dev/null || true
docker rm spark-history-server 2>/dev/null || true
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: e2e
run: task test-e2e
27 changes: 26 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,34 @@ tasks:
test:
desc: Run tests with pytest
cmds:
- uv run pytest --cov=. -cov-report=xml --cov-report=term-missing
- uv run pytest --cov=. -cov-report=xml --cov-report=term-missing .
- echo "✅ Tests completed!"

test-e2e:
desc: Run end-to-end tests with Spark and MCP servers
cmds:
- echo "🧪 Starting end-to-end tests..."
- task: start-spark-bg
- task: start-mcp-bg
- |
echo "Waiting for services to be available..."
# Wait for Spark History Server on port 18080
while ! curl -s http://localhost:18080 > /dev/null; do
echo "Waiting for Spark History Server..."
sleep 1
done
echo "✅ Spark History Server is available"

# Wait for MCP Server on port 18888
while ! curl -s http://localhost:18888 > /dev/null; do
echo "Waiting for MCP Server..."
sleep 1
done
echo "✅ MCP Server is available"
- |
echo "Running e2e tests..."
uv run pytest tests/e2e.py -v
- task: stop-all
test-verbose:
desc: Run tests with verbose output
cmds:
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "--cov=. --cov-report=term-missing"
pythonpath = ["."]
asyncio_mode = "auto"

[dependency-groups]
dev = [
Expand All @@ -73,4 +74,5 @@ dev = [
"ruff>=0.1.0",
"mypy>=1.7.0",
"pre-commit>=3.0.0",
"pytest-asyncio>=1.0.0",
]
Loading