Skip to content

Agent Mesh

fix e2e tests

Antonio Ojea2b901d4b1560
diff --git a/tests/e2e/datapath.bats b/tests/e2e/datapath.bats
index 925d4442..f5fd9a07 100644
--- a/tests/e2e/datapath.bats
+++ b/tests/e2e/datapath.bats
@@ -44,8 +44,8 @@ teardown() {
# Explicitly connect Node 1 to Node 2 (DHT auto-discovery is slow/unreliable in this E2E setup)
echo "[$(date +%T)] Explicitly connecting Node 1 to Node 2"
- local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
+ local node2_addr="/dns4/${node2_name}/tcp/5002/p2p/${node2_peer_id}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${node1_name}:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
# Verify connection
@@ -95,7 +95,7 @@ data = {
}
req = urllib.request.Request(
- \"http://sam-node-1:8080/sam/service/register\",
+ \"http://${node1_name}:8080/sam/service/register\",
data=json.dumps(data).encode(\"utf-8\"),
headers={
\"Authorization\": \"Bearer secret-token\",
@@ -128,7 +128,7 @@ data = {
}
req = urllib.request.Request(
- 'http://sam-node-2:8080/sam/service/register',
+ 'http://${node2_name}:8080/sam/service/register',
data=json.dumps(data).encode('utf-8'),
headers={
'Authorization': 'Bearer secret-token',
@@ -153,7 +153,7 @@ with urllib.request.urlopen(req) as response:
run docker run --rm --network "${MESH_NETWORK}" python:3.12 python3 -c "
import urllib.request
req = urllib.request.Request(
- \"http://sam-node-2:8080/sam/${node1_peer_id}/mcp/http-tool/\",
+ \"http://${node2_name}:8080/sam/${node1_peer_id}/mcp/http-tool/\",
headers={\"Authorization\": \"Bearer secret-token\"}
)
with urllib.request.urlopen(req) as response:
@@ -179,7 +179,7 @@ with urllib.request.urlopen(req) as response:
python:3.12 python3 -c "
import urllib.request
req = urllib.request.Request(
- \"http://sam-node-1:8080/sam/${node2_peer_id}/mcp/stdio-tool/\",
+ \"http://${node1_name}:8080/sam/${node2_peer_id}/mcp/stdio-tool/\",
headers={\"Authorization\": \"Bearer secret-token\"}
)
try:
@@ -207,7 +207,7 @@ except Exception as e:
import urllib.request
import os
req = urllib.request.Request(
- \"http://sam-node-1:8080/sam/${node2_peer_id}/mcp/stdio-tool/\",
+ \"http://${node1_name}:8080/sam/${node2_peer_id}/mcp/stdio-tool/\",
data=os.environ['MSG'].encode('utf-8'),
headers={
\"Authorization\": \"Bearer secret-token\",
diff --git a/tests/e2e/docs_snippets.bats b/tests/e2e/docs_snippets.bats
index 1280ed55..6642435a 100644
--- a/tests/e2e/docs_snippets.bats
+++ b/tests/e2e/docs_snippets.bats
@@ -33,7 +33,7 @@ teardown() {
-v "$(pwd)/sam-mcp-python:/sam-mcp-python" \
-v "$(pwd)/site/content/docs/snippets:/snippets" \
-e PYTHONPATH=/sam-mcp-python/src \
- -e SAM_MCP_URL="http://sam-node-1:8080/mcp" \
+ -e SAM_MCP_URL="http://${node1_name}:8080/mcp" \
-e SAM_API_TOKEN="secret-token" \
python:3.12 \
bash -c 'pip install mcp httpx && python3 /snippets/agent_demo.py'
diff --git a/tests/e2e/find_remote_tools.bats b/tests/e2e/find_remote_tools.bats
index 61a42584..d4cd1c54 100644
--- a/tests/e2e/find_remote_tools.bats
+++ b/tests/e2e/find_remote_tools.bats
@@ -57,15 +57,15 @@ teardown() {
node2_peer_id=$(docker logs "${MESH_PREFIX}-node-2" 2>&1 | grep "PeerID:" | head -n 1 | awk '{print $2}' | tr -d '\r')
echo "[$(date +%T)] Connecting Node 1 to Node 2"
- local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
+ local node2_addr="/dns4/${MESH_PREFIX}-node-2/tcp/5002/p2p/${node2_peer_id}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-1:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
mesh_wait_for_peer_connection 1 "${node2_peer_id}" 20
echo "[$(date +%T)] Calling find_remote_tools from Node 1, targeting Node 2"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp" \
+ -url "http://${MESH_PREFIX}-node-1:8080/mcp" \
-tool "find_remote_tools" \
-args "{\"peer_id\":\"${node2_peer_id}\"}"
echo "find_remote_tools output: $output"
@@ -109,10 +109,10 @@ teardown() {
node2_peer_id=$(docker logs "${MESH_PREFIX}-node-2" 2>&1 | grep "PeerID:" | head -n 1 | awk '{print $2}' | tr -d '\r')
echo "[$(date +%T)] Connecting Node 1 to Node 2"
- local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
+ local node2_addr="/dns4/${MESH_PREFIX}-node-2/tcp/5002/p2p/${node2_peer_id}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp" \
+ -url "http://${MESH_PREFIX}-node-1:8080/mcp" \
-tool "connect_peer" \
-args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
@@ -123,7 +123,7 @@ teardown() {
call_args="{\"peer_id\":\"${node2_peer_id}\",\"tool_name\":\"mcp://calculator/add\",\"arguments\":{\"a\":2,\"b\":3}}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp" \
+ -url "http://${MESH_PREFIX}-node-1:8080/mcp" \
-tool "call_remote_tool" \
-args "${call_args}"
echo "call_remote_tool output: $output"
@@ -158,10 +158,10 @@ teardown() {
node2_peer_id=$(docker logs "${MESH_PREFIX}-node-2" 2>&1 | grep "PeerID:" | head -n 1 | awk '{print $2}' | tr -d '\r')
echo "[$(date +%T)] Connecting Node 1 to Node 2"
- local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
+ local node2_addr="/dns4/${MESH_PREFIX}-node-2/tcp/5002/p2p/${node2_peer_id}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp" \
+ -url "http://${MESH_PREFIX}-node-1:8080/mcp" \
-tool "connect_peer" \
-args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
@@ -172,7 +172,7 @@ teardown() {
describe_args="{\"peer_id\":\"${node2_peer_id}\",\"tool_name\":\"mcp://calculator/add\"}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp" \
+ -url "http://${MESH_PREFIX}-node-1:8080/mcp" \
-tool "describe_remote_tool" \
-args "${describe_args}"
echo "describe_remote_tool output: $output"
@@ -221,10 +221,10 @@ teardown() {
node2_peer_id=$(docker logs "${MESH_PREFIX}-node-2" 2>&1 | grep "PeerID:" | head -n 1 | awk '{print $2}' | tr -d '\r')
echo "[$(date +%T)] Connecting Node 1 to Node 2"
- local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
+ local node2_addr="/dns4/${MESH_PREFIX}-node-2/tcp/5002/p2p/${node2_peer_id}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp" \
+ -url "http://${MESH_PREFIX}-node-1:8080/mcp" \
-tool "connect_peer" \
-args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
@@ -235,7 +235,7 @@ teardown() {
describe_args="{\"peer_id\":\"${node2_peer_id}\",\"tool_name\":\"mcp://calculator/does-not-exist\"}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp" \
+ -url "http://${MESH_PREFIX}-node-1:8080/mcp" \
-tool "describe_remote_tool" \
-args "${describe_args}"
echo "describe_remote_tool output: $output"
diff --git a/tests/e2e/lib/container_mesh.bash b/tests/e2e/lib/container_mesh.bash
index 0c3d46ce..7b3e4758 100644
--- a/tests/e2e/lib/container_mesh.bash
+++ b/tests/e2e/lib/container_mesh.bash
@@ -27,12 +27,10 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
}
mesh_build_runtime_image() {
- if ! docker image inspect "${MESH_RUNTIME_IMAGE}" >/dev/null 2>&1; then
- docker build \
- -f tests/e2e/docker/Dockerfile.sam-runtime \
- -t "${MESH_RUNTIME_IMAGE}" \
- . >/dev/null
- fi
+ docker build \
+ -f tests/e2e/docker/Dockerfile.sam-runtime \
+ -t "${MESH_RUNTIME_IMAGE}" \
+ . >/dev/null
}
mesh_setup_env() {
@@ -98,7 +96,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
local timeout_s="${2:-20}"
local i
for ((i=0; i<timeout_s; i++)); do
- if docker run --rm --network "${MESH_NETWORK}" python:3.12 curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer secret-token" -d '{"jsonrpc":"2.0","method":"ping","id":1}' --max-time 5 -D - http://sam-node-${idx}:8080/mcp | grep -q "200 OK"; then
+ if docker run --rm --network "${MESH_NETWORK}" python:3.12 curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer secret-token" -d '{"jsonrpc":"2.0","method":"ping","id":1}' --max-time 5 -D - http://${MESH_PREFIX}-node-${idx}:8080/mcp | grep -q "200 OK"; then
return 0
fi
sleep 1
@@ -109,7 +107,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
mesh_get_node_count_via_mcp() {
local idx="$1"
local output
- output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
echo "${output}" | jq 'if .connected_peers then (.connected_peers | length) - 1 else 0 end'
}
@@ -120,7 +118,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
local i
for ((i=0; i<timeout_s; i++)); do
local output
- output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
echo "Node ${idx} get_mesh_info raw output: ${output}"
local count
count="$(echo "${output}" | jq 'if .connected_peers then (.connected_peers | length) - 1 else 0 end')"
@@ -140,7 +138,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
local i
for ((i=0; i<timeout_s; i++)); do
local output
- output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
echo "[$(date +%T)] Node ${idx} get_mesh_info raw output: ${output}"
local connected
connected="$(echo "${output}" | jq -r --arg peer "$target_peer" '.connected_peers | index($peer) != null')"
@@ -160,7 +158,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
local i
for ((i=0; i<timeout_s; i++)); do
local output
- output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
echo "[$(date +%T)] Node ${idx} get_mesh_info raw output: ${output}"
local connected
connected="$(echo "${output}" | jq -r --arg peer "$target_peer" '.connected_peers | index($peer) != null')"
@@ -308,7 +306,7 @@ KIND
docker run -d \
--name "${name}" \
--network "${MESH_NETWORK}" \
- --network-alias "sam-node-${idx}" \
+ --network-alias "${name}" \
${add_hosts} \
"${mount_args[@]}" \
"${MESH_RUNTIME_IMAGE}" \
diff --git a/tests/e2e/policy.bats b/tests/e2e/policy.bats
index 2432c5c6..96a02f19 100644
--- a/tests/e2e/policy.bats
+++ b/tests/e2e/policy.bats
@@ -195,7 +195,7 @@ attenuation:
for ((i=0; i<40; i++)); do
local output
- output="$(docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-2:8080/mcp" -tool "get_mesh_info")"
+ output="$(docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-2:8080/mcp" -tool "get_mesh_info")"
TARGET_PEER_ID=$(echo "${output}" | grep -oE '12D3Koo[a-zA-Z0-9]+' | grep -v "${hub_id}" | grep -v "${node2_id}" | head -n 1)
if [[ -n "${TARGET_PEER_ID}" ]]; then
break
@@ -212,8 +212,8 @@ attenuation:
fi
# Explicitly connect Node 2 to Node 1 to avoid "no addresses" error
- local node1_addr="/dns4/sam-node-1/tcp/5002/p2p/${TARGET_PEER_ID}"
- docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-2:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node1_addr}\"}" >/dev/null
+ local node1_addr="/dns4/${MESH_PREFIX}-node-1/tcp/5002/p2p/${TARGET_PEER_ID}"
+ docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-2:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node1_addr}\"}" >/dev/null
}
teardown() {
@@ -233,7 +233,7 @@ teardown() {
@test "Policy E2E: Positive Path (Allowed by Hub, Not blocked by Node)" {
local call_args="{\"peer_id\":\"${TARGET_PEER_ID}\",\"tool_name\":\"mcp://calculator/add\",\"arguments\":{\"a\":2,\"b\":3}}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-2:8080/mcp" -tool "call_remote_tool" -args "${call_args}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-2:8080/mcp" -tool "call_remote_tool" -args "${call_args}"
echo "Output: $output"
[ "$status" -eq 0 ]
[[ "$output" == *"5"* ]]
@@ -241,14 +241,14 @@ teardown() {
@test "Policy E2E: Negative Path (Denied by Hub)" {
local call_args="{\"peer_id\":\"${TARGET_PEER_ID}\",\"tool_name\":\"mcp://unauthorized-service/reboot_server\",\"arguments\":{}}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-2:8080/mcp" -tool "call_remote_tool" -args "${call_args}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-2:8080/mcp" -tool "call_remote_tool" -args "${call_args}"
echo "Output: $output"
[[ "$output" == *"denied"* ]]
}
@test "Policy E2E: Attenuation Path (Allowed by Hub, Blocked by Node)" {
local call_args="{\"peer_id\":\"${TARGET_PEER_ID}\",\"tool_name\":\"mcp://db-agent/delete_tables\",\"arguments\":{}}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-2:8080/mcp" -tool "call_remote_tool" -args "${call_args}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${MESH_PREFIX}-node-2:8080/mcp" -tool "call_remote_tool" -args "${call_args}"
echo "Output: $output"
[[ "$output" == *"denied"* ]]
}
diff --git a/tests/e2e/python_sdk_test.bats b/tests/e2e/python_sdk_test.bats
index 1db098f7..fef4dcf9 100644
--- a/tests/e2e/python_sdk_test.bats
+++ b/tests/e2e/python_sdk_test.bats
@@ -34,6 +34,7 @@ teardown() {
-v "$(pwd)/sam-mcp-python:/sam-mcp-python" \
-e PYTHONPATH=/sam-mcp-python/src \
-e SAM_API_TOKEN=secret-token \
+ -e SAM_MCP_URL="http://${node1_name}:8080/mcp" \
python:3.12 \
bash -c 'pip install mcp httpx && python3 /sam-mcp-python/test_client.py'
echo "Python SDK output: $output"
diff --git a/tests/e2e/relay.bats b/tests/e2e/relay.bats
index bd412435..0e051d9a 100644
--- a/tests/e2e/relay.bats
+++ b/tests/e2e/relay.bats
@@ -9,6 +9,17 @@ setup() {
}
teardown() {
+ if [[ "${BATS_TEST_COMPLETED:-0}" -ne 1 ]]; then
+ mkdir -p tests/e2e/logs
+ local ids
+ ids="$(docker ps -aq --filter "name=mesh-")"
+ for id in ${ids}; do
+ local name
+ name="$(docker inspect -f '{{.Name}}' "${id}" | tr -d '/')"
+ docker logs "${id}" > "tests/e2e/logs/${name}.log" 2>&1 || true
+ done
+ fi
+
local item
for item in "${DISCONNECT_CONTAINERS[@]}"; do
local container="${item%%:*}"
@@ -129,7 +140,7 @@ data = {
}
req = urllib.request.Request(
- \"http://sam-node-1:8080/sam/service/register\",
+ \"http://${MESH_PREFIX}-node-1:8080/sam/service/register\",
data=json.dumps(data).encode('utf-8'),
headers={
\"Content-Type\": \"application/json\",
@@ -148,7 +159,7 @@ with urllib.request.urlopen(req) as response:
run docker run --rm --network "${MESH_NETWORK_2}" python:3.12 python3 -c "
import urllib.request
req = urllib.request.Request(
- \"http://sam-node-2:8080/sam/${node1_peer_id}/mcp/http-tool/\",
+ \"http://${MESH_PREFIX}-node-2:8080/sam/${node1_peer_id}/mcp/http-tool/\",
headers={\"Authorization\": \"Bearer secret-token\"}
)
with urllib.request.urlopen(req) as response:
diff --git a/tests/e2e/revocation_test.bats b/tests/e2e/revocation_test.bats
index d07143b2..63fa14b9 100644
--- a/tests/e2e/revocation_test.bats
+++ b/tests/e2e/revocation_test.bats
@@ -65,8 +65,8 @@ teardown() {
# Explicitly connect Node 1 to Node 2
echo "[$(date +%T)] Explicitly connecting Node 1 to Node 2"
- local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
+ local node2_addr="/dns4/${node2_name}/tcp/5002/p2p/${node2_peer_id}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${node1_name}:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
# Verify Node 1 connects to Node 2
@@ -110,16 +110,16 @@ teardown() {
# Verify Node 1 cannot reconnect to Node 2
echo "[$(date +%T)] Attempting to reconnect (should fail)"
- local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
+ local node2_addr="/dns4/${node2_name}/tcp/5002/p2p/${node2_peer_id}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${node1_name}:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
echo "Reconnect output: $output"
local info_output
- info_output="$(docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
+ info_output="$(docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://${node1_name}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
echo "After reconnect mesh info: ${info_output}"
local connected
connected="$(echo "${info_output}" | jq -r --arg peer "${node2_peer_id}" '.connected_peers | index($peer) != null')"
- echo "Connected after reconnect: ${connected}"
+ echo "Connected after reconnect: ${connected}"; echo "NODE 1 LOGS:"; docker logs "${MESH_PREFIX}-node-1"
[[ "$output" == *"gater disallows connection"* ]]
}
diff --git a/tests/e2e/services.bats b/tests/e2e/services.bats
index f1ca7ea8..e074c538 100644
--- a/tests/e2e/services.bats
+++ b/tests/e2e/services.bats
@@ -58,10 +58,10 @@ teardown() {
node2_peer_id=$(docker logs "${node2_name}" 2>&1 | grep "PeerID:" | head -n 1 | awk '{print $2}' | tr -d '\r')
echo "[$(date +%T)] Connecting Node 1 to Node 2"
- local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
+ local node2_addr="/dns4/${node2_name}/tcp/5002/p2p/${node2_peer_id}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp" \
+ -url "http://${node1_name}:8080/mcp" \
-tool "connect_peer" \
-args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
@@ -74,7 +74,7 @@ teardown() {
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
-timeout 30 \
- -url "http://sam-node-1:8080/mcp" \
+ -url "http://${node1_name}:8080/mcp" \
-tool "discover_remote_services" \
-args '{"type":"mcp"}'
echo "Discovery output: $output"