Skip to content

Commit 21f71fe

Browse files
committed
Add test for installation and start of standalone mcp servers
Assisted-by: Claude Opus 4.6
1 parent 14fd9fb commit 21f71fe

4 files changed

Lines changed: 84 additions & 5 deletions

File tree

.github/workflows/check-in-container.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- target: check-jira-issue-fetcher-in-container
2424
- target: check-ymir-common-in-container
2525
- target: check-supervisor-in-container
26+
- target: check-mcp-install-in-container
2627
steps:
2728
- name: Checkout code
2829
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ redis-cli:
285285
build-test-image:
286286
$(MAKE) -f Makefile.tests build-test-image
287287

288-
.PHONY: check-in-container check-agents-in-container check-unprivileged-tools-in-container check-privileged-tools-in-container check-jira-issue-fetcher-in-container check-ymir-common-in-container check-supervisor-in-container
288+
.PHONY: check-in-container check-agents-in-container check-unprivileged-tools-in-container check-privileged-tools-in-container check-jira-issue-fetcher-in-container check-ymir-common-in-container check-supervisor-in-container check-mcp-install-in-container
289289
check-in-container:
290290
$(MAKE) -f Makefile.tests check-in-container
291291
check-agents-in-container:
@@ -300,3 +300,5 @@ check-ymir-common-in-container:
300300
$(MAKE) -f Makefile.tests check-ymir-common-in-container
301301
check-supervisor-in-container:
302302
$(MAKE) -f Makefile.tests check-supervisor-in-container
303+
check-mcp-install-in-container:
304+
$(MAKE) -f Makefile.tests check-mcp-install-in-container

Makefile.tests

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ build-test-image-c9s:
1414
$(CONTAINER_ENGINE) build --rm --tag $(TEST_IMAGE_C9S) -f Containerfile.c9s-tests
1515

1616
.PHONY: check check-agents check-unprivileged-tools check-privileged-tools check-jira-issue-fetcher check-ymir-common \
17-
check-supervisor check-in-container check-agents-in-container check-unprivileged-tools-in-container \
17+
check-supervisor check-mcp-install check-in-container check-agents-in-container check-unprivileged-tools-in-container \
1818
check-privileged-tools-in-container check-jira-issue-fetcher-in-container check-ymir-common-in-container \
19-
check-supervisor-in-container
19+
check-supervisor-in-container check-mcp-install-in-container
2020

2121
define RUN_TESTS
2222
PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=1 python3 -m pytest --verbose --showlocals $(addprefix $(1),$(TEST_TARGET))
@@ -35,7 +35,10 @@ check-ymir-common:
3535
check-supervisor:
3636
$(call RUN_TESTS,ymir/supervisor/)
3737

38-
check: check-agents check-unprivileged-tools check-privileged-tools check-jira-issue-fetcher check-ymir-common check-supervisor
38+
check-mcp-install:
39+
PYTHONPATH= bash scripts/test_mcp_install.sh
40+
41+
check: check-agents check-unprivileged-tools check-privileged-tools check-jira-issue-fetcher check-ymir-common check-supervisor check-mcp-install
3942

4043
define RUN_TESTS_IN_CONTAINER
4144
$(CONTAINER_ENGINE) run --rm -it -v $(CURDIR):/src:z --env TEST_TARGET $(1) make -f Makefile.tests $(2)
@@ -53,6 +56,9 @@ check-ymir-common-in-container:
5356
$(call RUN_TESTS_IN_CONTAINER,$(TEST_IMAGE_C9S),check-ymir-common)
5457
check-supervisor-in-container:
5558
$(call RUN_TESTS_IN_CONTAINER,$(TEST_IMAGE_C9S),check-supervisor)
59+
check-mcp-install-in-container:
60+
$(call RUN_TESTS_IN_CONTAINER,$(TEST_IMAGE),check-mcp-install)
5661

5762
check-in-container: check-agents-in-container check-unprivileged-tools-in-container check-privileged-tools-in-container \
58-
check-jira-issue-fetcher-in-container check-ymir-common-in-container check-supervisor-in-container
63+
check-jira-issue-fetcher-in-container check-ymir-common-in-container check-supervisor-in-container \
64+
check-mcp-install-in-container

scripts/test_mcp_install.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
# Smoke test: verify that ymir-common and ymir-tools can be pip-installed
3+
# from the local source tree and that both MCP gateways start without
4+
# import errors.
5+
#
6+
# This replicates the installation path described in skills_installation.md
7+
# and guards against broken transitive imports that would prevent the
8+
# servers from starting for end users.
9+
10+
set -euo pipefail
11+
12+
VENV_DIR=$(mktemp -d)/mcp-install-test
13+
14+
cleanup() { rm -rf "$(dirname "$VENV_DIR")"; }
15+
trap cleanup EXIT
16+
17+
echo "==> Creating isolated venv at ${VENV_DIR}"
18+
python3 -m venv --system-site-packages "$VENV_DIR"
19+
# shellcheck disable=SC1091
20+
source "$VENV_DIR/bin/activate"
21+
22+
echo "==> Installing ymir-common"
23+
pip install --no-cache-dir ./ymir/common
24+
25+
echo "==> Installing ymir-tools"
26+
pip install --no-cache-dir ./ymir/tools
27+
28+
echo "==> Verifying gateway module imports"
29+
python -c "from ymir.tools.privileged.gateway import main; print(' privileged gateway: OK')"
30+
python -c "from ymir.tools.unprivileged.gateway import main; print(' unprivileged gateway: OK')"
31+
32+
echo "==> Verifying console-script entry points"
33+
command -v ymir-privileged-gateway
34+
command -v ymir-unprivileged-gateway
35+
36+
echo "==> Starting privileged gateway (expecting clean startup)"
37+
MCP_TRANSPORT=stdio timeout 5 ymir-privileged-gateway &
38+
PID_PRIV=$!
39+
40+
echo "==> Starting unprivileged gateway (expecting clean startup)"
41+
MCP_TRANSPORT=stdio timeout 5 ymir-unprivileged-gateway &
42+
PID_UNPRIV=$!
43+
44+
# Expected exit codes:
45+
# 0 — server started, ran through init, and exited because stdin
46+
# was closed (background process gets no tty); proves startup
47+
# succeeded.
48+
# 124 — timeout killed the still-running process; also proves startup
49+
# succeeded.
50+
# Any other code means the gateway crashed (e.g. import error).
51+
FAIL=0
52+
53+
RC_PRIV=0; wait $PID_PRIV || RC_PRIV=$?
54+
RC_UNPRIV=0; wait $PID_UNPRIV || RC_UNPRIV=$?
55+
56+
if [ "$RC_PRIV" -ne 0 ] && [ "$RC_PRIV" -ne 124 ]; then
57+
echo "FAIL: privileged gateway exited with code $RC_PRIV"
58+
FAIL=1
59+
fi
60+
if [ "$RC_UNPRIV" -ne 0 ] && [ "$RC_UNPRIV" -ne 124 ]; then
61+
echo "FAIL: unprivileged gateway exited with code $RC_UNPRIV"
62+
FAIL=1
63+
fi
64+
65+
if [ "$FAIL" -ne 0 ]; then
66+
echo "MCP gateway installation smoke test FAILED."
67+
exit 1
68+
fi
69+
70+
echo "MCP gateway installation smoke test passed."

0 commit comments

Comments
 (0)