Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
fix e2e python tests
Antonio Ojeaa040e843bb7d
diff --git a/sam-mcp-python/src/sam_mcp/client.py b/sam-mcp-python/src/sam_mcp/client.pyindex 75b8941d..791c5097 100644--- a/sam-mcp-python/src/sam_mcp/client.py+++ b/sam-mcp-python/src/sam_mcp/client.py@@ -16,7 +16,7 @@ class SamClient:async def connect(self):"""Connects to the SAM node via SSE."""- self._sse_cm = sse_client(self.server_url)+ self._sse_cm = sse_client(self.server_url, headers={"Accept": "application/json, text/event-stream"})read_stream, write_stream = await self._sse_cm.__aenter__()self.session = ClientSession(read_stream, write_stream)await self.session.__aenter__()diff --git a/tests/e2e/lib/container_mesh.bash b/tests/e2e/lib/container_mesh.bashindex f63be665..373f65f6 100644--- a/tests/e2e/lib/container_mesh.bash+++ b/tests/e2e/lib/container_mesh.bash@@ -171,7 +171,7 @@ sys.exit(1)local ifor ((i=0; i<timeout_s; i++)); dolocal output- output="$(timeout 15s docker run --rm -v "${MESH_SOCKET_DIR}:/sockets" -v "$(pwd)/bin/mcp-client:/mcp-client" python:3.12 /mcp-client -socket "/sockets/node-${idx}.sock" 2>/dev/null)"+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" -v "$(pwd)/bin/mcp-client:/mcp-client" python:3.12 /mcp-client -url "http://sam-node-${idx}:8080/" 2>/dev/null)"echo "[$(date +%T)] Node ${idx} get_mesh_info raw output: ${output}"local connectedconnected="$(echo "${output}" | jq -r --arg peer "$target_peer" '.connected_peers | index($peer) != null')"@@ -191,7 +191,7 @@ sys.exit(1)local ifor ((i=0; i<timeout_s; i++)); dolocal output- output="$(timeout 15s docker run --rm -v "${MESH_SOCKET_DIR}:/sockets" -v "$(pwd)/bin/mcp-client:/mcp-client" python:3.12 /mcp-client -socket "/sockets/node-${idx}.sock" 2>/dev/null)"+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" -v "$(pwd)/bin/mcp-client:/mcp-client" python:3.12 /mcp-client -url "http://sam-node-${idx}:8080/" 2>/dev/null)"echo "[$(date +%T)] Node ${idx} get_mesh_info raw output: ${output}"local connectedconnected="$(echo "${output}" | jq -r --arg peer "$target_peer" '.connected_peers | index($peer) != null')"diff --git a/tests/e2e/python_sdk_test.bats b/tests/e2e/python_sdk_test.batsindex 33ed26ee..42c288ee 100644--- a/tests/e2e/python_sdk_test.bats+++ b/tests/e2e/python_sdk_test.bats@@ -38,14 +38,14 @@ teardown() {-v "$(pwd)/sam-mcp-python:/sam-mcp-python" \-e PYTHONPATH=/sam-mcp-python/src \python:3.12 \- bash -c 'pip install mcp >/dev/null && python3 -c "+ bash -c 'pip install mcp && python3 -c "import asynciofrom sam_mcp.client import SamClientimport osimport sysasync def main():- os.environ[\"SAM_MCP_URL\"] = \"http://sam-node-1:8080/\"+ os.environ[\"SAM_MCP_URL\"] = \"http://sam-node-1:8080/mcp\"try:async with SamClient() as client:# Test get_tools