chore(trainer): add unit tests for platform runtime tools#97
chore(trainer): add unit tests for platform runtime tools#97Solaris-star wants to merge 2 commits into
Conversation
Part of kubeflow#68 platform slice. Cover patch_runtime/create_runtime/delete_runtime preview and confirmed paths with mocked CustomObjects API, including validation and error wrapping. Signed-off-by: Solaris-star <solaris@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
🎉 Welcome to the Kubeflow MCP Server! 🎉 Thanks for opening your first PR! We're happy to have you as part of our community 🚀 Here's what happens next:
Join the community:
Feel free to ask questions in the comments if you need any help or clarification! |
There was a problem hiding this comment.
Pull request overview
Adds unit coverage for Trainer platform runtime CRUD tools using mocked Kubernetes APIs.
Changes:
- Tests validation and preview behavior.
- Tests confirmed mutations and Kubernetes errors.
- Tests dependent TrainJob handling during deletion.
| "kubeflow_mcp.trainer.api.platform.mcp_utils.get_custom_objects_api", | ||
| return_value=api, | ||
| ): | ||
| result = patch_runtime("torch-tune", patch=patch_body, confirmed=True) |
There was a problem hiding this comment.
Thanks for flagging this. The shared Pattern C scaffold in #6 is not on main yet, so this PR cannot import it without duplicating that open PR. In 7e536dd I tightened the patch_runtime confirmed-path coverage to verify the complete Kubernetes API invocation, including group, version, plural, payload/name, and request timeout. Once #6 lands, I can rebase and convert this file to its shared fixtures.
| "kubeflow_mcp.trainer.api.platform.mcp_utils.get_custom_objects_api", | ||
| return_value=api, | ||
| ): | ||
| result = create_runtime("my-runtime", spec=spec, confirmed=True) |
There was a problem hiding this comment.
Thanks for flagging this. The shared Pattern C scaffold in #6 is not on main yet, so this PR cannot import it without duplicating that open PR. In 7e536dd I tightened the create_runtime confirmed-path coverage to verify the complete Kubernetes API invocation, including group, version, plural, payload/name, and request timeout. Once #6 lands, I can rebase and convert this file to its shared fixtures.
| "kubeflow_mcp.trainer.api.platform.mcp_utils.get_custom_objects_api", | ||
| return_value=api, | ||
| ): | ||
| result = delete_runtime("torch-tune", confirmed=True) |
There was a problem hiding this comment.
Thanks for flagging this. The shared Pattern C scaffold in #6 is not on main yet, so this PR cannot import it without duplicating that open PR. In 7e536dd I tightened the delete_runtime confirmed-path coverage to verify the complete Kubernetes API invocation, including group, version, plural, payload/name, and request timeout. Once #6 lands, I can rebase and convert this file to its shared fixtures.
|
Thanks for the review. I agree the confirmed runtime paths should use the shared Pattern C utilities. The relevant I will rebase after #6 lands, convert the confirmed create/patch/delete cases to the shared fixtures, and assert the complete Kubernetes SDK invocations before requesting maintainer review. |
Signed-off-by: Solaris-star <820622658@qq.com>
Summary
Part of #68 — platform section.
Adds unit coverage for runtime CRUD tools with mocked CustomObjects API:
patch_runtimeconfirmed=Falsecreate_runtimedelete_runtimeTesting
uv run pytest -q tests/unit/trainer/test_platform.py # 16 passed