Skip to main content
Glama
test_basic.py1.52 kB
"""Basic tests for GCP MCP server.""" import pytest from unittest.mock import Mock, patch from gcp_mcp.config import Config from gcp_mcp.auth import GCPAuthenticator from gcp_mcp.server import GCPMCPServer def test_config_creation(): """Test basic config creation.""" config = Config() assert config.max_results == 1000 assert config.log_retention_days == 30 def test_config_load_with_env_vars(): """Test config loading with environment variables.""" with patch.dict('os.environ', {'GCP_PROJECT': 'test-project'}): config = Config.load() assert config.default_project == 'test-project' def test_server_initialization(): """Test server initialization.""" server = GCPMCPServer() assert server.config is not None assert server.authenticator is not None assert server.logging_tools is not None assert server.monitoring_tools is not None @pytest.mark.asyncio async def test_logging_tools_get_tools(): """Test that logging tools return expected tools.""" config = Config() authenticator = Mock(spec=GCPAuthenticator) from gcp_mcp.tools.logging_tools import LoggingTools logging_tools = LoggingTools(authenticator, config) tools = await logging_tools.get_tools() assert len(tools) == 4 tool_names = [tool.name for tool in tools] assert "query_logs" in tool_names assert "analyze_error_logs" in tool_names assert "get_recent_errors" in tool_names assert "search_logs_by_message" in tool_names

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JayRajGoyal/gcp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server