本章说明 ShardingSphere-MCP 的端到端契约验证和 LLM usability 验证。
test/e2e/mcp 覆盖:
当某个 MCP feature 被作为 workflow 模板时,E2E 测试应覆盖协议可发现性、模型可用性和负向契约。 以 Encrypt workflow 为例,模板级验收至少包括:
resources_to_read 指向 feature 自有算法、规则或配置资源,而不是不属于该 feature 的物理元数据资源。测试复用应保留在 test/e2e/mcp 内的本地 helper 中;不要为了模板验收新增测试 jar 或跨模块测试支撑模块。
先安装 MCP E2E 依赖模块到本地仓库:
./mvnw -pl test/e2e/mcp -am install -DskipTests -DskipITs -Dspotless.skip=true -B -ntp
打包 MCP distribution 并构建本地 distribution image:
./mvnw -pl distribution/mcp -am -DskipTests package -B -ntp
docker build -f distribution/mcp/Dockerfile -t apache/shardingsphere-mcp-e2e:local distribution/mcp/target
MCP LLM lane 默认使用本地 Docker image 承载 OpenAI-compatible endpoint。 构建前建议先查看 Docker 占用:
docker system df
只校验本机架构选择,不下载模型:
sh test/e2e/mcp/src/test/resources/docker/llm-runtime/build-local.sh --dry-run
构建本地 runtime image:
sh test/e2e/mcp/src/test/resources/docker/llm-runtime/build-local.sh
MCP E2E 运行配置集中在 test/e2e/mcp/src/test/resources/env/e2e-env.properties。
本地运行时可以直接修改该文件,也可以使用同名 -D 系统参数覆盖。
./mvnw -pl test/e2e/mcp test -DskipITs -Dspotless.skip=true \
-Dtest='*E2ETest' \
-Dsurefire.failIfNoSpecifiedTests=true \
-De2e.run.type=DOCKER \
-Dmcp.e2e.container.image=apache/shardingsphere-mcp-e2e:local
./mvnw -pl test/e2e/mcp test -DskipITs -Dspotless.skip=true \
-Dtest=LLMUsabilitySuiteE2ETest \
-Dsurefire.failIfNoSpecifiedTests=true \
-De2e.run.type=DOCKER
仅本地调试时,可以连接已经运行的 OpenAI-compatible endpoint:
./mvnw -pl test/e2e/mcp test -DskipITs -Dspotless.skip=true \
-Dtest=LLMUsabilitySuiteE2ETest \
-De2e.run.type=DOCKER \
-Dmcp.llm.runtime-mode=external-debug \
-Dmcp.llm.base-url=http://127.0.0.1:8080/v1 \
-Dsurefire.failIfNoSpecifiedTests=true
External debug endpoint 不能作为 score-closing evidence。
LLM artifact 写入:
test/e2e/mcp/target/llm-e2e/
GitHub Actions 入口:
.github/workflows/e2e-mcp.yml这条 workflow 是 MCP runtime E2E 的必跑入口。
如果超大 PR 因 path filter 限制漏触发,可以使用 workflow_dispatch 手动补充 evidence。
