test(mcp): Support task integration tests#3185
Merged
hengyunabc merged 7 commits intoalibaba:masterfrom May 8, 2026
Merged
Conversation
- add task ITs for capabilities, create/get/result and cancel - add TTL expiration coverage for tasks/get and tasks/result - add dedicated concurrency IT for multiple task-aware tools - extract shared MCP task test support - extend TargetJvmApp with multiple hot methods for stable concurrent testing
Body: Reduce DEFAULT_MAX_CONCURRENT_TASK_SESSIONS from 10 to 5 to better protect the target JVM from excessive concurrent instrumentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
本 PR 为
arthas-mcp-integration-test增加 MCP task 能力的集成测试覆盖,并补充用于稳定并发场景的目标 JVM 方法。涉及文件:
arthas-mcp-integration-test/src/test/java/com/taobao/arthas/mcp/it/task/ArthasMcpTasksIT.javaarthas-mcp-integration-test/src/test/java/com/taobao/arthas/mcp/it/task/ArthasMcpTasksConcurrencyIT.javaarthas-mcp-integration-test/src/test/java/com/taobao/arthas/mcp/it/task/ArthasMcpTaskTestSupport.javaarthas-mcp-integration-test/src/test/java/com/taobao/arthas/mcp/it/TargetJvmApp.java主要内容
1. 新增基础 task 集成测试
新增
ArthasMcpTasksIT,覆盖以下主链路:initialize返回 task capabilitiestools/list中 task-aware tools 的taskSupport=OPTIONALtools/call带 task metadata 创建 tasktasks/listtasks/gettasks/resulttasks/canceltasks/get/tasks/result行为2. 新增并发 task 集成测试
新增
ArthasMcpTasksConcurrencyIT,验证多个 task-aware 命令并发执行。当前并发测试不是简单地同时发 3 个
watch到同一个方法,而是:watch->hotMethodAtrace->hotMethodBstack->hotMethodC避免把测试重点落在单一命令对同一目标方法的增强竞争上,使测试更聚焦 MCP task 并发执行能力本身。
3. 抽取共享测试支撑
新增
ArthasMcpTaskTestSupport,统一复用:这样可以减少 task 测试文件之间的重复实现,后续扩展 task 用例也更方便。
4. 扩展 TargetJvmApp
修改
TargetJvmApp,新增:hotMethodAhotMethodBhotMethodC并在主循环中持续调用这些方法,为并发 task 集成测试提供稳定、可区分的目标方法。