Migration from Docker to Standalone Python Server (#73)
* Migration from docker to standalone server Migration handling Fixed tests Use simpler in-memory storage Support for concurrent logging to disk Simplified direct connections to localhost * Migration from docker / redis to standalone script Updated tests Updated run script Fixed requirements Use dotenv Ask if user would like to install MCP in Claude Desktop once Updated docs * More cleanup and references to docker removed * Cleanup * Comments * Fixed tests * Fix GitHub Actions workflow for standalone Python architecture - Install requirements-dev.txt for pytest and testing dependencies - Remove Docker setup from simulation tests (now standalone) - Simplify linting job to use requirements-dev.txt - Update simulation tests to run directly without Docker Fixes unit test failures in CI due to missing pytest dependency. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Remove simulation tests from GitHub Actions - Removed simulation-tests job that makes real API calls - Keep only unit tests (mocked, no API costs) and linting - Simulation tests should be run manually with real API keys - Reduces CI costs and complexity GitHub Actions now only runs: - Unit tests (569 tests, all mocked) - Code quality checks (ruff, black) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Fixed tests * Fixed tests --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
9d72545ecd
commit
4151c3c3a5
@@ -8,7 +8,6 @@ Tests that verify the system correctly falls back to OpenRouter when:
|
||||
- Auto mode correctly selects OpenRouter models
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
|
||||
from .base_test import BaseSimulatorTest
|
||||
|
||||
@@ -24,53 +23,28 @@ class OpenRouterFallbackTest(BaseSimulatorTest):
|
||||
def test_description(self) -> str:
|
||||
return "OpenRouter fallback behavior when only provider"
|
||||
|
||||
def get_recent_server_logs(self) -> str:
|
||||
"""Get recent server logs from the log file directly"""
|
||||
try:
|
||||
cmd = ["docker", "exec", self.container_name, "tail", "-n", "300", "/tmp/mcp_server.log"]
|
||||
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||
|
||||
if result.returncode == 0:
|
||||
return result.stdout
|
||||
else:
|
||||
self.logger.warning(f"Failed to read server logs: {result.stderr}")
|
||||
return ""
|
||||
except Exception as e:
|
||||
self.logger.error(f"Failed to get server logs: {e}")
|
||||
return ""
|
||||
|
||||
def run_test(self) -> bool:
|
||||
"""Test OpenRouter fallback behavior"""
|
||||
try:
|
||||
self.logger.info("Test: OpenRouter fallback behavior when only provider available")
|
||||
|
||||
# Check if ONLY OpenRouter API key is configured (this is a fallback test)
|
||||
check_cmd = [
|
||||
"docker",
|
||||
"exec",
|
||||
self.container_name,
|
||||
"python",
|
||||
"-c",
|
||||
'import os; print("OPENROUTER_KEY:" + str(bool(os.environ.get("OPENROUTER_API_KEY"))) + "|GEMINI_KEY:" + str(bool(os.environ.get("GEMINI_API_KEY"))) + "|OPENAI_KEY:" + str(bool(os.environ.get("OPENAI_API_KEY"))))',
|
||||
]
|
||||
result = subprocess.run(check_cmd, capture_output=True, text=True)
|
||||
import os
|
||||
|
||||
if result.returncode == 0:
|
||||
output = result.stdout.strip()
|
||||
has_openrouter = "OPENROUTER_KEY:True" in output
|
||||
has_gemini = "GEMINI_KEY:True" in output
|
||||
has_openai = "OPENAI_KEY:True" in output
|
||||
has_openrouter = bool(os.environ.get("OPENROUTER_API_KEY"))
|
||||
has_gemini = bool(os.environ.get("GEMINI_API_KEY"))
|
||||
has_openai = bool(os.environ.get("OPENAI_API_KEY"))
|
||||
|
||||
if not has_openrouter:
|
||||
self.logger.info(" ⚠️ OpenRouter API key not configured - skipping test")
|
||||
self.logger.info(" ℹ️ This test requires OPENROUTER_API_KEY to be set in .env")
|
||||
return True # Return True to indicate test is skipped, not failed
|
||||
if not has_openrouter:
|
||||
self.logger.info(" ⚠️ OpenRouter API key not configured - skipping test")
|
||||
self.logger.info(" ℹ️ This test requires OPENROUTER_API_KEY to be set in .env")
|
||||
return True # Return True to indicate test is skipped, not failed
|
||||
|
||||
if has_gemini or has_openai:
|
||||
self.logger.info(" ⚠️ Other API keys configured - this is not a fallback scenario")
|
||||
self.logger.info(" ℹ️ This test requires ONLY OpenRouter to be configured (no Gemini/OpenAI keys)")
|
||||
self.logger.info(" ℹ️ Current setup has multiple providers, so fallback behavior doesn't apply")
|
||||
return True # Return True to indicate test is skipped, not failed
|
||||
if has_gemini or has_openai:
|
||||
self.logger.info(" ⚠️ Other API keys configured - this is not a fallback scenario")
|
||||
self.logger.info(" ℹ️ This test requires ONLY OpenRouter to be configured (no Gemini/OpenAI keys)")
|
||||
self.logger.info(" ℹ️ Current setup has multiple providers, so fallback behavior doesn't apply")
|
||||
return True # Return True to indicate test is skipped, not failed
|
||||
|
||||
# Setup test files
|
||||
self.setup_test_files()
|
||||
|
||||
Reference in New Issue
Block a user