test(api): add unit tests for various control APIs#91
Merged
Conversation
Added comprehensive unit tests for the AgentRuntimeControlAPI, CredentialControlAPI, KnowledgeBaseControlAPI, MemoryCollectionControlAPI, ModelControlAPI, SandboxControlAPI, ToolControlAPI, and ToolsetControlAPI. These tests ensure that the API methods correctly match the underlying SDK client method signatures, improving code reliability and maintainability. --- 新增各控制 API 的单元测试 为 AgentRuntimeControlAPI、CredentialControlAPI、KnowledgeBaseControlAPI、MemoryCollectionControlAPI、ModelControlAPI、SandboxControlAPI、ToolControlAPI 和 ToolsetControlAPI 添加了全面的单元测试。这些测试确保 API 方法与底层 SDK 客户端方法签名正确匹配,提高了代码的可靠性和可维护性。 Change-Id: I1d1f89ae1d9bc4c67e5d31bded1864b9790daa25 Signed-off-by: OhYee <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds unit tests that validate the control-layer APIs invoke the underlying Alibaba Cloud SDK client methods with matching signatures, and updates the AgentRun SDK dependency and one generated control API to reflect updated SDK signatures.
Changes:
- Added signature-verification unit tests for multiple
*ControlAPImodules (sync + async), usingcreate_autospecto enforce SDK method signatures. - Updated
AgentRuntimeControlAPIgenerated code to match updated SDK method signatures (removed now-unneeded request objects for some endpoints). - Bumped
alibabacloud-agentrun20250910minimum version to>=5.6.3.
Reviewed changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unittests/agent_runtime/api/test_control.py | Adds autospec-based signature tests for AgentRuntime control APIs (sync/async). |
| tests/unittests/credential/api/test_control.py | Adds autospec-based signature tests for Credential control APIs (sync/async). |
| tests/unittests/credential/api/init.py | Test package init for credential API tests. |
| tests/unittests/knowledgebase/api/test_control.py | Adds autospec-based signature tests for KnowledgeBase control APIs (sync/async). |
| tests/unittests/memory_collection/api/test_control.py | Adds autospec-based signature tests for MemoryCollection control APIs (sync/async). |
| tests/unittests/memory_collection/api/init.py | Test package init for memory_collection API tests. |
| tests/unittests/model/api/test_control.py | Adds autospec-based signature tests for Model control APIs (service/proxy, sync/async). |
| tests/unittests/sandbox/api/test_control.py | Adds autospec-based signature tests for Sandbox control APIs (sync/async). |
| tests/unittests/tool/api/test_control.py | Adds autospec-based signature tests for Tool control APIs (sync/async). |
| tests/unittests/tool/api/init.py | Test package init for tool API tests. |
| tests/unittests/toolset/api/test_control.py | Adds autospec-based signature tests for toolset control API using DevsClient (sync/async). |
| pyproject.toml | Bumps alibabacloud-agentrun20250910 dependency to >=5.6.3. |
| agentrun/agent_runtime/api/control.py | Adjusts generated AgentRuntime control calls to match updated SDK signatures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+12
to
+14
|
|
||
| from agentrun.toolset.api.control import ToolControlAPI | ||
| from agentrun.utils.config import Config |
There was a problem hiding this comment.
PR 描述中提到的是 “ToolsetControlAPI”,但此处实际被测对象与实现类名是 agentrun.toolset.api.control.ToolControlAPI。为避免读者误解(尤其是 tool vs toolset 两条链路同时存在),建议统一命名:要么在 PR 描述/测试类名中使用 ToolControlAPI(toolset),要么在代码生成/导出层提供 ToolsetControlAPI 的别名。
Sodawyx
approved these changes
Apr 22, 2026
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.
Added comprehensive unit tests for the AgentRuntimeControlAPI, CredentialControlAPI, KnowledgeBaseControlAPI, MemoryCollectionControlAPI, ModelControlAPI, SandboxControlAPI, ToolControlAPI, and ToolsetControlAPI. These tests ensure that the API methods correctly match the underlying SDK client method signatures, improving code reliability and maintainability.
新增各控制 API 的单元测试
为 AgentRuntimeControlAPI、CredentialControlAPI、KnowledgeBaseControlAPI、MemoryCollectionControlAPI、ModelControlAPI、SandboxControlAPI、ToolControlAPI 和 ToolsetControlAPI 添加了全面的单元测试。这些测试确保 API 方法与底层 SDK 客户端方法签名正确匹配,提高了代码的可靠性和可维护性。
Change-Id: I1d1f89ae1d9bc4c67e5d31bded1864b9790daa25
Fix bugs
Bug detail
Pull request tasks
Update docs
Reason for update
Pull request tasks
Add contributor
Contributed content
Content detail
Others
Reason for update