Skip to content

Commit 739cf03

Browse files
committed
refactor: update CI workflow and clean up test configurations
- Reduced Python versions in CI workflow from four to three, removing 3.9. - Removed Redis service setup and related tests from CI workflow for simplification. - Cleaned up test assertions in `test_provider_determination.py` and `test_resilient_oauth.py` for improved readability.
1 parent 29aecd9 commit 739cf03

File tree

4 files changed

+9
-90
lines changed

4 files changed

+9
-90
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python-version: ["3.9", "3.10", "3.11", "3.12"]
16-
17-
services:
18-
redis:
19-
image: redis:7-alpine
20-
ports:
21-
- 6379:6379
22-
options: >-
23-
--health-cmd "redis-cli ping"
24-
--health-interval 10s
25-
--health-timeout 5s
26-
--health-retries 5
15+
python-version: ["3.10", "3.11", "3.12"]
2716

2817
steps:
2918
- uses: actions/checkout@v4
@@ -41,30 +30,10 @@ jobs:
4130
4231
# Install coverage for test reporting
4332
pip install pytest-cov>=4.0.0
44-
45-
# Install storage backend dependencies for comprehensive testing
46-
# Use modern redis library for Python 3.11+ compatibility
47-
if [[ "${{ matrix.python-version }}" == "3.11" || "${{ matrix.python-version }}" == "3.12" ]]; then
48-
pip install 'redis[hiredis]>=4.5.0'
49-
else
50-
pip install aioredis>=2.0.0
51-
fi
52-
53-
# Install Vault dependencies
54-
pip install hvac>=1.2.0 aiohttp>=3.8.0
55-
56-
- name: Wait for Redis
57-
run: |
58-
timeout 30 bash -c 'until redis-cli ping; do sleep 1; done'
5933
6034
- name: Run tests with coverage
6135
run: |
6236
python -m pytest -v --tb=short --cov=src --cov-report=xml --cov-report=term-missing
63-
env:
64-
# Redis service connection for testing
65-
REDIS_HOST: localhost
66-
REDIS_PORT: 6379
67-
REDIS_PASSWORD: ""
6837
6938
- name: Upload coverage to Codecov
7039
uses: codecov/codecov-action@v3
@@ -77,54 +46,4 @@ jobs:
7746
run: |
7847
python -m src.gateway --help
7948
80-
- name: Test storage backends
81-
run: |
82-
# Test memory storage (default)
83-
python -c "
84-
import asyncio
85-
from src.storage.manager import StorageManager
86-
from src.config.config import StorageConfig
87-
88-
async def test():
89-
config = StorageConfig(type='memory')
90-
manager = StorageManager(config)
91-
storage = await manager.start_storage()
92-
await storage.set('test', {'data': 'value'})
93-
result = await storage.get('test')
94-
assert result == {'data': 'value'}
95-
await manager.stop_storage()
96-
print('✅ Memory storage test passed')
97-
98-
asyncio.run(test())
99-
"
100-
101-
# Test Redis storage with service
102-
python -c "
103-
import asyncio
104-
from src.storage.manager import StorageManager
105-
from src.config.config import StorageConfig, RedisStorageConfig
106-
107-
async def test():
108-
config = StorageConfig(
109-
type='redis',
110-
redis=RedisStorageConfig(
111-
host='localhost',
112-
port=6379,
113-
password='',
114-
db=0,
115-
ssl=False,
116-
max_connections=20
117-
)
118-
)
119-
manager = StorageManager(config)
120-
storage = await manager.start_storage()
121-
await storage.set('test', {'redis': 'works'})
122-
result = await storage.get('test')
123-
assert result == {'redis': 'works'}
124-
await manager.stop_storage()
125-
print('✅ Redis storage test passed')
126-
127-
asyncio.run(test())
128-
"
129-
env:
130-
REDIS_HOST: localhost
49+

demo/fastmcp_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from fastmcp import Context, FastMCP
2-
from fastmcp.server.middleware import Middleware, MiddlewareContext
32
from fastmcp.exceptions import ToolError
3+
from fastmcp.server.middleware import Middleware, MiddlewareContext
44

55

66
class UserAuthMiddleware(Middleware):

tests/gateway/test_provider_determination.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ def test_provider_determination_malformed_resources(self, minimal_config):
297297

298298
for resource in malformed_resources:
299299
provider = gateway._determine_provider_for_resource(resource)
300-
assert provider == "github", (
301-
f"Failed for malformed resource: {resource}"
302-
)
300+
assert (
301+
provider == "github"
302+
), f"Failed for malformed resource: {resource}"
303303

304304
def test_provider_determination_unicode_resources(self, minimal_config):
305305
"""Test provider determination with unicode characters in resources."""

tests/integration/test_resilient_oauth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ def test_all_services_use_same_provider(self, github_config):
190190
provider = gateway._determine_provider_for_resource(
191191
f"http://localhost:8080/{service}/mcp"
192192
)
193-
assert provider == "github", (
194-
f"Service {service} returned wrong provider: {provider}"
195-
)
193+
assert (
194+
provider == "github"
195+
), f"Service {service} returned wrong provider: {provider}"
196196

197197
def test_provider_determination_performance(self, github_config):
198198
"""Test that provider determination is consistently fast."""

0 commit comments

Comments
 (0)