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
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,31 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Cache virtual environment
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
venv-${{ runner.os }}-

- name: Create virtual environment
run: uv venv

- name: Install dependencies
run: uv pip install -e ".[dev]"

- name: Prune uv cache for CI
run: uv cache prune --ci

- name: Run ruff (lint and format check)
run: |
uv run ruff check .
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'

- name: Install uv
uses: astral-sh/setup-uv@v4
Expand All @@ -29,6 +30,9 @@ jobs:
- name: Build wheel and sdist
run: uvx --from build pyproject-build --installer uv

- name: Prune uv cache for CI
run: uv cache prune --ci

- name: Upload release artifacts to GitHub
uses: actions/upload-artifact@v4
with:
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,3 @@ clusters.yaml
artifacts/
# Development artifacts
uv.lock
CLEANUP-QUICKSTART.md
README-CLEANUP.md
cleanup-namespaces.sh
41 changes: 20 additions & 21 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

import pytest

from mcp_acp.server import (
_format_bulk_result,
_format_clusters,
_format_logs,
_format_result,
_format_sessions_list,
_format_whoami,
call_tool,
list_tools,
from mcp_acp.formatters import (
format_bulk_result,
format_clusters,
format_logs,
format_result,
format_sessions_list,
format_whoami,
)
from mcp_acp.server import call_tool, list_tools


class TestServerFormatters:
Expand All @@ -27,7 +26,7 @@ def test_format_result_dry_run(self) -> None:
"session_info": {"name": "test-session", "status": "running"},
}

output = _format_result(result)
output = format_result(result)

assert "DRY RUN MODE" in output
assert "Would delete session" in output
Expand All @@ -37,7 +36,7 @@ def test_format_result_normal(self) -> None:
"""Test formatting normal results."""
result = {"deleted": True, "message": "Successfully deleted session"}

output = _format_result(result)
output = format_result(result)

assert "Successfully deleted session" in output

Expand Down Expand Up @@ -66,7 +65,7 @@ def test_format_sessions_list(self) -> None:
],
}

output = _format_sessions_list(result)
output = format_sessions_list(result)

assert "Found 2 session(s)" in output
assert "session-1" in output
Expand All @@ -87,7 +86,7 @@ def test_format_bulk_result_delete_dry_run(self) -> None:
},
}

output = _format_bulk_result(result, "delete")
output = format_bulk_result(result, "delete")

assert "DRY RUN MODE" in output
assert "Would delete 2 session(s)" in output
Expand All @@ -103,7 +102,7 @@ def test_format_bulk_result_delete_normal(self) -> None:
"failed": [{"session": "session-3", "error": "Not found"}],
}

output = _format_bulk_result(result, "delete")
output = format_bulk_result(result, "delete")

assert "Successfully deleted 2 session(s)" in output
assert "session-1" in output
Expand All @@ -126,7 +125,7 @@ def test_format_bulk_result_stop_dry_run(self) -> None:
},
}

output = _format_bulk_result(result, "stop")
output = format_bulk_result(result, "stop")

assert "DRY RUN MODE" in output
assert "Would stop 1 session(s)" in output
Expand All @@ -142,7 +141,7 @@ def test_format_logs(self) -> None:
"lines": 3,
}

output = _format_logs(result)
output = format_logs(result)

assert "container 'runner'" in output
assert "3 lines" in output
Expand All @@ -153,7 +152,7 @@ def test_format_logs_error(self) -> None:
"""Test formatting logs with error."""
result = {"error": "Pod not found"}

output = _format_logs(result)
output = format_logs(result)

assert "Error: Pod not found" in output

Expand All @@ -179,7 +178,7 @@ def test_format_clusters(self) -> None:
"default_cluster": "test-cluster",
}

output = _format_clusters(result)
output = format_clusters(result)

assert "test-cluster [DEFAULT]" in output
assert "prod-cluster" in output
Expand All @@ -191,7 +190,7 @@ def test_format_clusters_empty(self) -> None:
"""Test formatting empty clusters list."""
result = {"clusters": [], "default_cluster": None}

output = _format_clusters(result)
output = format_clusters(result)

assert "No clusters configured" in output

Expand All @@ -205,7 +204,7 @@ def test_format_whoami_authenticated(self) -> None:
"token_valid": True,
}

output = _format_whoami(result)
output = format_whoami(result)

assert "Authenticated: Yes" in output
assert "User: testuser" in output
Expand All @@ -223,7 +222,7 @@ def test_format_whoami_not_authenticated(self) -> None:
"token_valid": False,
}

output = _format_whoami(result)
output = format_whoami(result)

assert "Authenticated: No" in output
assert "not authenticated" in output
Expand Down
Loading