Skip to content

test(mcp): add edge case coverage for MCP registry serialization#218

Merged
2-Coatl merged 2 commits intofeature/implement-mcp-server-installation-and-configuration-05-50-55from
copilot/sub-pr-216-again
Nov 18, 2025
Merged

test(mcp): add edge case coverage for MCP registry serialization#218
2-Coatl merged 2 commits intofeature/implement-mcp-server-installation-and-configuration-05-50-55from
copilot/sub-pr-216-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 16, 2025

Resumen

Este PR añade cobertura de pruebas para casos extremos en el builder de registro MCP, respondiendo al feedback de revisión de código en PR #216.

Cambios principales

1. Tests de casos extremos (7 nuevos tests)

Registros vacíos

  • test_empty_registry_serializes_correctly: Valida serialización correcta cuando no hay servidores remotos ni locales

Servidores remotos con headers

  • test_remote_server_with_custom_headers: Verifica inclusión de headers personalizados (Authorization, X-Custom-Header)
  • test_remote_server_without_custom_headers: Confirma que headers no se incluyen cuando no están definidos

Servidores locales con variables de entorno

  • test_local_server_with_custom_env_variables: Valida serialización de env vars (NODE_ENV, DEBUG)
  • test_local_server_without_custom_env_variables: Confirma que env no se incluye cuando no está definido

Colecciones mixtas vacías

  • test_registry_with_mixed_empty_collections: Registry con solo servidores remotos
  • test_registry_with_only_local_servers: Registry con solo servidores locales

2. Ejemplo de uso

# Empty registry
empty = MCPRegistry(remote_servers=(), local_servers=())
assert empty.as_cli_config() == {"remote": {}, "local": {}}

# Custom headers
server = RemoteMCPServer(
    name="api",
    url="https://api.example.com",
    headers={"Authorization": "Bearer token"}
)
assert "headers" in server.as_cli_entry()

# Custom env vars
local = LocalMCPServer(
    name="node-server",
    command="node",
    args=("server.js",),
    env={"NODE_ENV": "production"}
)
assert local.as_cli_entry()["env"]["NODE_ENV"] == "production"

Estadísticas

  • 1 archivo modificado
  • 106 líneas agregadas
  • Cobertura: 3 → 10 tests (233% incremento)
  • Todos los tests pasan

Archivos modificados

scripts/coding/tests/ai/mcp/test_registry.py (+106 líneas)

Testing realizado

  • Suite completa ejecutada con pytest
  • 10/10 tests pasando
  • Sin regresiones en tests existentes

Integración con procesos existentes

  • Sigue convenciones de testing del proyecto
  • Mantiene consistencia con estructura de tests existentes
  • Cumple con requisitos de cobertura ≥80%

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@2-Coatl 2-Coatl marked this pull request as ready for review November 16, 2025 06:05
Copilot AI review requested due to automatic review settings November 16, 2025 06:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Co-authored-by: 2-Coatl <121911012+2-Coatl@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback on MCP registry builder test(mcp): add edge case coverage for MCP registry serialization Nov 16, 2025
Copilot AI requested a review from 2-Coatl November 16, 2025 06:10
@2-Coatl 2-Coatl merged commit 93b30c3 into feature/implement-mcp-server-installation-and-configuration-05-50-55 Nov 18, 2025
@2-Coatl 2-Coatl deleted the copilot/sub-pr-216-again branch November 18, 2025 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants